diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2012-04-21 17:49:11 +0200 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2012-04-21 17:49:11 +0200 |
commit | ce3c7fab938c755b10d5e55bddccdde1be4819f1 (patch) | |
tree | f79ec90750a9d52039b0d3139d674aa417cc57e5 | |
parent | 2357d6d8da9a3640852ae4fe3448ca68d85540b8 (diff) | |
download | jquery-ui-ce3c7fab938c755b10d5e55bddccdde1be4819f1.tar.gz jquery-ui-ce3c7fab938c755b10d5e55bddccdde1be4819f1.zip |
Update to official qunit composite addon
26 files changed, 159 insertions, 140 deletions
diff --git a/tests/unit/accordion/all.html b/tests/unit/accordion/all.html index ec9c003d9..2fb783c1c 100644 --- a/tests/unit/accordion/all.html +++ b/tests/unit/accordion/all.html @@ -7,9 +7,9 @@ <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> - <link rel="stylesheet" href="../subsuiteRunner.css"> + <link rel="stylesheet" href="../qunit-composite.css"> <script src="../../../external/qunit.js"></script> - <script src="../subsuiteRunner.js"></script> + <script src="../qunit-composite.js"></script> <script src="../subsuite.js"></script> <script> diff --git a/tests/unit/all-active.html b/tests/unit/all-active.html index 89c10441d..b3e2fbcba 100644 --- a/tests/unit/all-active.html +++ b/tests/unit/all-active.html @@ -7,9 +7,9 @@ <script src="../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../external/qunit.css"> - <link rel="stylesheet" href="subsuiteRunner.css"> + <link rel="stylesheet" href="qunit-composite.css"> <script src="../../external/qunit.js"></script> - <script src="subsuiteRunner.js"></script> + <script src="qunit-composite.js"></script> <script> (function() { diff --git a/tests/unit/all.html b/tests/unit/all.html index e48b1ac0e..6d98df0f9 100644 --- a/tests/unit/all.html +++ b/tests/unit/all.html @@ -7,9 +7,9 @@ <script src="../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../external/qunit.css"> - <link rel="stylesheet" href="subsuiteRunner.css"> + <link rel="stylesheet" href="qunit-composite.css"> <script src="../../external/qunit.js"></script> - <script src="subsuiteRunner.js"></script> + <script src="qunit-composite.js"></script> <script> (function() { diff --git a/tests/unit/autocomplete/all.html b/tests/unit/autocomplete/all.html index 87cde75fb..e35777f65 100644 --- a/tests/unit/autocomplete/all.html +++ b/tests/unit/autocomplete/all.html @@ -7,9 +7,9 @@ <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> - <link rel="stylesheet" href="../subsuiteRunner.css"> + <link rel="stylesheet" href="../qunit-composite.css"> <script src="../../../external/qunit.js"></script> - <script src="../subsuiteRunner.js"></script> + <script src="../qunit-composite.js"></script> <script src="../subsuite.js"></script> <script> diff --git a/tests/unit/button/all.html b/tests/unit/button/all.html index 115743e94..6c46c9650 100644 --- a/tests/unit/button/all.html +++ b/tests/unit/button/all.html @@ -7,9 +7,9 @@ <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> - <link rel="stylesheet" href="../subsuiteRunner.css"> + <link rel="stylesheet" href="../qunit-composite.css"> <script src="../../../external/qunit.js"></script> - <script src="../subsuiteRunner.js"></script> + <script src="../qunit-composite.js"></script> <script src="../subsuite.js"></script> <script> diff --git a/tests/unit/core/all.html b/tests/unit/core/all.html index 78bbe9aef..e31d6905c 100644 --- a/tests/unit/core/all.html +++ b/tests/unit/core/all.html @@ -7,9 +7,9 @@ <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> - <link rel="stylesheet" href="../subsuiteRunner.css"> + <link rel="stylesheet" href="../qunit-composite.css"> <script src="../../../external/qunit.js"></script> - <script src="../subsuiteRunner.js"></script> + <script src="../qunit-composite.js"></script> <script src="../subsuite.js"></script> <script> diff --git a/tests/unit/datepicker/all.html b/tests/unit/datepicker/all.html index 1540705f8..c62c7c07d 100644 --- a/tests/unit/datepicker/all.html +++ b/tests/unit/datepicker/all.html @@ -7,9 +7,9 @@ <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> - <link rel="stylesheet" href="../subsuiteRunner.css"> + <link rel="stylesheet" href="../qunit-composite.css"> <script src="../../../external/qunit.js"></script> - <script src="../subsuiteRunner.js"></script> + <script src="../qunit-composite.js"></script> <script src="../subsuite.js"></script> <script> diff --git a/tests/unit/dialog/all.html b/tests/unit/dialog/all.html index 973119c08..b1c69c6c9 100644 --- a/tests/unit/dialog/all.html +++ b/tests/unit/dialog/all.html @@ -7,9 +7,9 @@ <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> - <link rel="stylesheet" href="../subsuiteRunner.css"> + <link rel="stylesheet" href="../qunit-composite.css"> <script src="../../../external/qunit.js"></script> - <script src="../subsuiteRunner.js"></script> + <script src="../qunit-composite.js"></script> <script src="../subsuite.js"></script> <script> diff --git a/tests/unit/draggable/all.html b/tests/unit/draggable/all.html index 1b2a511a5..75df351ad 100644 --- a/tests/unit/draggable/all.html +++ b/tests/unit/draggable/all.html @@ -7,9 +7,9 @@ <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> - <link rel="stylesheet" href="../subsuiteRunner.css"> + <link rel="stylesheet" href="../qunit-composite.css"> <script src="../../../external/qunit.js"></script> - <script src="../subsuiteRunner.js"></script> + <script src="../qunit-composite.js"></script> <script src="../subsuite.js"></script> <script> diff --git a/tests/unit/droppable/all.html b/tests/unit/droppable/all.html index 535f41521..aa24ed7e1 100644 --- a/tests/unit/droppable/all.html +++ b/tests/unit/droppable/all.html @@ -7,9 +7,9 @@ <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> - <link rel="stylesheet" href="../subsuiteRunner.css"> + <link rel="stylesheet" href="../qunit-composite.css"> <script src="../../../external/qunit.js"></script> - <script src="../subsuiteRunner.js"></script> + <script src="../qunit-composite.js"></script> <script src="../subsuite.js"></script> <script> diff --git a/tests/unit/effects/all.html b/tests/unit/effects/all.html index 0ef901292..59500588c 100644 --- a/tests/unit/effects/all.html +++ b/tests/unit/effects/all.html @@ -7,9 +7,9 @@ <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> - <link rel="stylesheet" href="../subsuiteRunner.css"> + <link rel="stylesheet" href="../qunit-composite.css"> <script src="../../../external/qunit.js"></script> - <script src="../subsuiteRunner.js"></script> + <script src="../qunit-composite.js"></script> <script src="../subsuite.js"></script> <script> diff --git a/tests/unit/menu/all.html b/tests/unit/menu/all.html index a58e15299..475c1b717 100644 --- a/tests/unit/menu/all.html +++ b/tests/unit/menu/all.html @@ -7,9 +7,9 @@ <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> - <link rel="stylesheet" href="../subsuiteRunner.css"> + <link rel="stylesheet" href="../qunit-composite.css"> <script src="../../../external/qunit.js"></script> - <script src="../subsuiteRunner.js"></script> + <script src="../qunit-composite.js"></script> <script src="../subsuite.js"></script> <script> diff --git a/tests/unit/position/all.html b/tests/unit/position/all.html index fa3ecf23d..d76f9bbd8 100644 --- a/tests/unit/position/all.html +++ b/tests/unit/position/all.html @@ -7,9 +7,9 @@ <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> - <link rel="stylesheet" href="../subsuiteRunner.css"> + <link rel="stylesheet" href="../qunit-composite.css"> <script src="../../../external/qunit.js"></script> - <script src="../subsuiteRunner.js"></script> + <script src="../qunit-composite.js"></script> <script src="../subsuite.js"></script> <script> diff --git a/tests/unit/progressbar/all.html b/tests/unit/progressbar/all.html index eefb9c135..16b9e0ace 100644 --- a/tests/unit/progressbar/all.html +++ b/tests/unit/progressbar/all.html @@ -7,9 +7,9 @@ <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> - <link rel="stylesheet" href="../subsuiteRunner.css"> + <link rel="stylesheet" href="../qunit-composite.css"> <script src="../../../external/qunit.js"></script> - <script src="../subsuiteRunner.js"></script> + <script src="../qunit-composite.js"></script> <script src="../subsuite.js"></script> <script> diff --git a/tests/unit/qunit-composite.css b/tests/unit/qunit-composite.css new file mode 100644 index 000000000..df47362db --- /dev/null +++ b/tests/unit/qunit-composite.css @@ -0,0 +1,13 @@ +iframe.qunit-subsuite{ + position: fixed; + bottom: 0; + left: 0; + + margin: 0; + padding: 0; + border-width: 1px 0 0; + height: 45%; + width: 100%; + + background: #fff; +}
\ No newline at end of file diff --git a/tests/unit/qunit-composite.js b/tests/unit/qunit-composite.js new file mode 100644 index 000000000..5b753e2ee --- /dev/null +++ b/tests/unit/qunit-composite.js @@ -0,0 +1,102 @@ +(function( QUnit ) { + +QUnit.extend( QUnit, { + testSuites: function( suites ) { + QUnit.begin(function() { + QUnit.initIframe(); + }); + + for ( var i = 0; i < suites.length; i++ ) { + (function( suite ) { + asyncTest( suite, function() { + QUnit.runSuite( suite ); + }); + }( suites[i] ) ); + } + QUnit.done(function() { + this.iframe.style.display = "none"; + }); + }, + + runSuite: function( suite ) { + this.iframe.setAttribute( "src", suite ); + }, + + 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; + + + 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 current = QUnit.id( this.config.current.id ), + children = current.children, + src = this.iframe.src; + + // undo the auto-expansion of failed tests + for ( var 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 ) ); diff --git a/tests/unit/resizable/all.html b/tests/unit/resizable/all.html index 1c6811282..bef29ff6e 100644 --- a/tests/unit/resizable/all.html +++ b/tests/unit/resizable/all.html @@ -7,9 +7,9 @@ <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> - <link rel="stylesheet" href="../subsuiteRunner.css"> + <link rel="stylesheet" href="../qunit-composite.css"> <script src="../../../external/qunit.js"></script> - <script src="../subsuiteRunner.js"></script> + <script src="../qunit-composite.js"></script> <script src="../subsuite.js"></script> <script> diff --git a/tests/unit/selectable/all.html b/tests/unit/selectable/all.html index bfebf46c2..51778e771 100644 --- a/tests/unit/selectable/all.html +++ b/tests/unit/selectable/all.html @@ -7,9 +7,9 @@ <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> - <link rel="stylesheet" href="../subsuiteRunner.css"> + <link rel="stylesheet" href="../qunit-composite.css"> <script src="../../../external/qunit.js"></script> - <script src="../subsuiteRunner.js"></script> + <script src="../qunit-composite.js"></script> <script src="../subsuite.js"></script> <script> diff --git a/tests/unit/slider/all.html b/tests/unit/slider/all.html index 5aac26ced..bfadc0380 100644 --- a/tests/unit/slider/all.html +++ b/tests/unit/slider/all.html @@ -7,9 +7,9 @@ <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> - <link rel="stylesheet" href="../subsuiteRunner.css"> + <link rel="stylesheet" href="../qunit-composite.css"> <script src="../../../external/qunit.js"></script> - <script src="../subsuiteRunner.js"></script> + <script src="../qunit-composite.js"></script> <script src="../subsuite.js"></script> <script> diff --git a/tests/unit/sortable/all.html b/tests/unit/sortable/all.html index 89e239250..f9d63d62e 100644 --- a/tests/unit/sortable/all.html +++ b/tests/unit/sortable/all.html @@ -7,9 +7,9 @@ <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> - <link rel="stylesheet" href="../subsuiteRunner.css"> + <link rel="stylesheet" href="../qunit-composite.css"> <script src="../../../external/qunit.js"></script> - <script src="../subsuiteRunner.js"></script> + <script src="../qunit-composite.js"></script> <script src="../subsuite.js"></script> <script> diff --git a/tests/unit/spinner/all.html b/tests/unit/spinner/all.html index e41e088c4..72a2dd77a 100644 --- a/tests/unit/spinner/all.html +++ b/tests/unit/spinner/all.html @@ -7,9 +7,9 @@ <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> - <link rel="stylesheet" href="../subsuiteRunner.css"> + <link rel="stylesheet" href="../qunit-composite.css"> <script src="../../../external/qunit.js"></script> - <script src="../subsuiteRunner.js"></script> + <script src="../qunit-composite.js"></script> <script src="../subsuite.js"></script> <script> diff --git a/tests/unit/subsuiteRunner.css b/tests/unit/subsuiteRunner.css deleted file mode 100644 index bca30a75e..000000000 --- a/tests/unit/subsuiteRunner.css +++ /dev/null @@ -1,8 +0,0 @@ -iframe.qunit-subsuite { - margin: 0; - padding: 0; - border-width: 1px 0 0; - height: 600px; - width: 100%; - background: #fff; -}
\ No newline at end of file diff --git a/tests/unit/subsuiteRunner.js b/tests/unit/subsuiteRunner.js deleted file mode 100644 index 2d6de2de1..000000000 --- a/tests/unit/subsuiteRunner.js +++ /dev/null @@ -1,88 +0,0 @@ -(function( QUnit ) { - -var subsuiteFrame; - -QUnit.extend( QUnit, { - testSuites: function( suites ) { - function generateSuite( suite ) { - asyncTest( suite, function() { - QUnit.runSuite( suite ); - }); - } - - for ( var i = 0; i < suites.length; i++ ) { - generateSuite( suites[ i ] ); - } - - QUnit.done = function() { - subsuiteFrame.style.display = "none"; - }; - }, - - testStart: function( data ) { - // update the test status to show which test suite is running - QUnit.id( "qunit-testresult" ).innerHTML = "Running " + data.name + "...<br> "; - }, - - testDone: function() { - var current = QUnit.id( this.config.current.id ), - children = current.children, - i = 0, - length = children.length; - - // undo the auto-expansion of failed tests - for ( ; i < length; i++ ) { - if ( children[i].nodeName === "OL" ) { - children[i].style.display = "none"; - } - } - }, - - runSuite: function( suite ) { - var iframeWin, - body = document.getElementsByTagName( "body" )[0], - iframe = document.createElement( "iframe" ); - - subsuiteFrame = iframe; - iframe.className = "qunit-subsuite"; - body.appendChild( iframe ); - - function onIframeLoad() { - var module, test, - count = 0; - - QUnit.extend( iframeWin.QUnit, { - moduleStart: function( data ) { - // capture module name for messages - module = data.name; - }, - - testStart: function( data ) { - // capture test name for messages - test = data.name; - }, - - log: function( data ) { - // 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 ); - }, - - done: function() { - // start the wrapper test from the main page - start(); - } - }); - } - QUnit.addEvent( iframe, "load", onIframeLoad ); - - iframeWin = iframe.contentWindow; - iframe.setAttribute( "src", suite ); - - this.runSuite = function( suite ) { - iframe.setAttribute( "src", suite ); - }; - } -}); -}( QUnit ) ); diff --git a/tests/unit/tabs/all.html b/tests/unit/tabs/all.html index 1da3ecad2..41bf965f2 100644 --- a/tests/unit/tabs/all.html +++ b/tests/unit/tabs/all.html @@ -7,9 +7,9 @@ <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> - <link rel="stylesheet" href="../subsuiteRunner.css"> + <link rel="stylesheet" href="../qunit-composite.css"> <script src="../../../external/qunit.js"></script> - <script src="../subsuiteRunner.js"></script> + <script src="../qunit-composite.js"></script> <script src="../subsuite.js"></script> <script> diff --git a/tests/unit/tooltip/all.html b/tests/unit/tooltip/all.html index deb628e2f..c1aa35acf 100644 --- a/tests/unit/tooltip/all.html +++ b/tests/unit/tooltip/all.html @@ -7,9 +7,9 @@ <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> - <link rel="stylesheet" href="../subsuiteRunner.css"> + <link rel="stylesheet" href="../qunit-composite.css"> <script src="../../../external/qunit.js"></script> - <script src="../subsuiteRunner.js"></script> + <script src="../qunit-composite.js"></script> <script src="../subsuite.js"></script> <script> diff --git a/tests/unit/widget/all.html b/tests/unit/widget/all.html index cad4bdd72..e5b16c8d7 100644 --- a/tests/unit/widget/all.html +++ b/tests/unit/widget/all.html @@ -7,9 +7,9 @@ <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> - <link rel="stylesheet" href="../subsuiteRunner.css"> + <link rel="stylesheet" href="../qunit-composite.css"> <script src="../../../external/qunit.js"></script> - <script src="../subsuiteRunner.js"></script> + <script src="../qunit-composite.js"></script> <script src="../subsuite.js"></script> <script> |