diff options
author | Alvin Li <liweitianux@gmail.com> | 2013-10-09 15:52:53 +0800 |
---|---|---|
committer | Alvin Li <liweitianux@gmail.com> | 2013-10-09 15:52:53 +0800 |
commit | 02afd8a32edb13ea7fc2266ac80092ea15c0930c (patch) | |
tree | c7a2a3f50378c017b425da47e04a71c6beaae56c /97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/qunit-composite.js | |
parent | fafce2cfc72f4e1cd14ff6cb693c8ec7854159c5 (diff) | |
download | 97dev-02afd8a32edb13ea7fc2266ac80092ea15c0930c.tar.bz2 |
* treat 'apps/utils' as regular django app; which used to store
general tools for used in other apps
* moved 'templatetags' from 'apps/indicator' to 'apps/utils'
* '.gitignore' to ignore 'fixtures_bak'
* moved js plugins from 'apps/indicator/static/plugins' to
'staticfiles/plugins'
apps/recommend:
* updated 'recommend.models';
o commented 'recommend.models.ResearchCombination' (not used)
* implemented views 'add_edit_blog_info' and 'ajax_add_edit_configs';
* added pages 'templates/recommend/add_edit_blog_info.html',
'add_edit_blog_info_error.html';
o related css and javascripts files
* added 'tools.py';
* added 'utils/tools.py' for placing generic functions;
* deleted 'initial_data.json' (mv 'fixtures' to 'fixtures_bak');
* small fixes to 'indicator.models', 'sciblog.models' and
'sfaccount.views'
* fixed automatically show 'proper_nouns' annotation in blog:
recovered the line 'import signals' in 'sciblog.models'
* added 'is_ok()' method for 'recommend.models.ResearchConfig';
Diffstat (limited to '97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/qunit-composite.js')
-rw-r--r-- | 97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/qunit-composite.js | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/qunit-composite.js b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/qunit-composite.js new file mode 100644 index 0000000..2e54540 --- /dev/null +++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/qunit-composite.js @@ -0,0 +1,112 @@ +(function( QUnit ) { + +QUnit.extend( QUnit, { + testSuites: function( suites ) { + QUnit.begin(function() { + QUnit.initIframe(); + }); + + for ( var i = 0; i < suites.length; i++ ) { + QUnit.runSuite( suites[i] ); + } + + QUnit.done(function() { + this.iframe.style.display = "none"; + }); + }, + + runSuite: function( suite ) { + var path = suite; + + if ( QUnit.is( "object", suite ) ) { + path = suite.path; + suite = suite.name; + } + + asyncTest( suite, function() { + QUnit.iframe.setAttribute( "src", path ); + }); + }, + + initIframe: function() { + var body = document.body, + iframe = this.iframe = document.createElement( "iframe" ), + iframeWin; + + iframe.className = "qunit-subsuite"; + body.appendChild( iframe ); + + function onIframeLoad() { + var module, test, + count = 0; + + if (iframe.src === "") { + return; + } + + iframeWin.QUnit.moduleStart(function( data ) { + // capture module name for messages + module = data.name; + }); + + iframeWin.QUnit.testStart(function( data ) { + // capture test name for messages + test = data.name; + }); + iframeWin.QUnit.testDone(function() { + test = null; + }); + + iframeWin.QUnit.log(function( data ) { + if (test === null) { + return; + } + // pass all test details through to the main page + var message = module + ": " + test + ": " + data.message; + expect( ++count ); + QUnit.push( data.result, data.actual, data.expected, message ); + }); + + iframeWin.QUnit.done(function() { + // start the wrapper test from the main page + start(); + }); + } + QUnit.addEvent( iframe, "load", onIframeLoad ); + + iframeWin = iframe.contentWindow; + } +}); + +QUnit.testStart(function( data ) { + // update the test status to show which test suite is running + QUnit.id( "qunit-testresult" ).innerHTML = "Running " + data.name + "...<br> "; +}); + +QUnit.testDone(function() { + var i, + current = QUnit.id( this.config.current.id ), + children = current.children, + src = this.iframe.src; + + // undo the auto-expansion of failed tests + for ( i = 0; i < children.length; i++ ) { + if ( children[i].nodeName === "OL" ) { + children[i].style.display = "none"; + } + } + + QUnit.addEvent(current, "dblclick", function( e ) { + var target = e && e.target ? e.target : window.event.srcElement; + if ( target.nodeName.toLowerCase() === "span" || target.nodeName.toLowerCase() === "b" ) { + target = target.parentNode; + } + if ( window.location && target.nodeName.toLowerCase() === "strong" ) { + window.location = src; + } + }); + + current.getElementsByTagName("a")[0].href = src; +}); + +}( QUnit ) ); |