diff options
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/accordion/accordion.html | 2 | ||||
-rw-r--r-- | tests/unit/all.html | 45 | ||||
-rw-r--r-- | tests/unit/autocomplete/autocomplete.html | 2 | ||||
-rw-r--r-- | tests/unit/button/button.html | 2 | ||||
-rw-r--r-- | tests/unit/core/core.html | 2 | ||||
-rw-r--r-- | tests/unit/datepicker/datepicker.html | 2 | ||||
-rw-r--r-- | tests/unit/dialog/dialog.html | 2 | ||||
-rw-r--r-- | tests/unit/draggable/draggable.html | 2 | ||||
-rw-r--r-- | tests/unit/droppable/droppable.html | 2 | ||||
-rw-r--r-- | tests/unit/position/position.html | 2 | ||||
-rw-r--r-- | tests/unit/progressbar/progressbar.html | 2 | ||||
-rw-r--r-- | tests/unit/resizable/resizable.html | 2 | ||||
-rw-r--r-- | tests/unit/selectable/selectable.html | 2 | ||||
-rw-r--r-- | tests/unit/slider/slider.html | 2 | ||||
-rw-r--r-- | tests/unit/sortable/sortable.html | 2 | ||||
-rw-r--r-- | tests/unit/tabs/tabs.html | 2 | ||||
-rw-r--r-- | tests/unit/testsuites.js | 76 | ||||
-rw-r--r-- | tests/unit/widget/widget.html | 2 |
18 files changed, 137 insertions, 16 deletions
diff --git a/tests/unit/accordion/accordion.html b/tests/unit/accordion/accordion.html index e84f85147..25fbb28f9 100644 --- a/tests/unit/accordion/accordion.html +++ b/tests/unit/accordion/accordion.html @@ -60,7 +60,7 @@ <ol id="qunit-tests"> </ol> -<div id="main" style="position: absolute; top: -10000px; left: -10000px;"> +<div id="qunit-fixtures"> <div> <div id="list1" class="foo"> diff --git a/tests/unit/all.html b/tests/unit/all.html new file mode 100644 index 000000000..8b146c12f --- /dev/null +++ b/tests/unit/all.html @@ -0,0 +1,45 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <title>jQuery UI Test Suite</title> + + <script src="../../jquery-1.5.1.js"></script> + + <link rel="stylesheet" href="../../external/qunit.css"> + <script src="../../external/qunit.js"></script> + <script src="testsuites.js"></script> + + <script> + QUnit.testSuites([ + "accordion/accordion.html", + "autocomplete/autocomplete.html", + "button/button.html", + "core/core.html", + "datepicker/datepicker.html", + "dialog/dialog.html", + //"draggable/draggable.html", + //"droppable/droppable.html", + "position/position.html", + "progressbar/progressbar.html", + //"resizable/resizable.html", + //"selectable/selectable.html", + "slider/slider.html", + //"sortable/sortable.html", + "tabs/tabs.html", + "widget/widget.html" + ]); + </script> +</head> +<body> + +<h1 id="qunit-header">jQuery UI Test Suite</h1> +<h2 id="qunit-banner"></h2> +<div id="qunit-testrunner-toolbar"></div> +<h2 id="qunit-userAgent"></h2> +<ol id="qunit-tests"></ol> +<div id="qunit-fixture"> + +</div> +</body> +</html> diff --git a/tests/unit/autocomplete/autocomplete.html b/tests/unit/autocomplete/autocomplete.html index 9a14ae01c..20fd105a9 100644 --- a/tests/unit/autocomplete/autocomplete.html +++ b/tests/unit/autocomplete/autocomplete.html @@ -34,7 +34,7 @@ <ol id="qunit-tests"> </ol> -<div id="main" style="position: absolute; top: -10000px; left: -10000px;"> +<div id="qunit-fixture"> <div id="ac-wrap1" class="ac-wrap"></div> <div id="ac-wrap2" class="ac-wrap"><input id="autocomplete" class="foo" /></div> diff --git a/tests/unit/button/button.html b/tests/unit/button/button.html index b3774e6c0..747a2aa05 100644 --- a/tests/unit/button/button.html +++ b/tests/unit/button/button.html @@ -33,7 +33,7 @@ <ol id="qunit-tests"> </ol> -<div id="main" style="position: absolute; top: -10000px; left: -10000px;"> +<div id="qunit-fixture"> <div><button id="button" class="foo">Label</button></div> diff --git a/tests/unit/core/core.html b/tests/unit/core/core.html index bf2c8275e..b315251d9 100644 --- a/tests/unit/core/core.html +++ b/tests/unit/core/core.html @@ -31,7 +31,7 @@ <ol id="qunit-tests"> </ol> -<div id="main" style="position: absolute; top: -10000px; left: -10000px;"> +<div id="qunit-fixture"> <img src="../images/jqueryui_32x32.png" usemap="#mymap" width="10", height="10"> <map name="mymap"> diff --git a/tests/unit/datepicker/datepicker.html b/tests/unit/datepicker/datepicker.html index f297265c3..90ae5c08c 100644 --- a/tests/unit/datepicker/datepicker.html +++ b/tests/unit/datepicker/datepicker.html @@ -46,7 +46,7 @@ <ol id="qunit-tests"> </ol> -<div id="main" style="position: absolute; top: -10000px; left: -10000px;"> +<div id="qunit-fixture"> <p><input type="text" id="inp"/><input type="text" id="alt"/><div id="inl"></div></p> <p><input type="text" id="inp2"/></p> </div> diff --git a/tests/unit/dialog/dialog.html b/tests/unit/dialog/dialog.html index 6e85c42c7..6eb4b92b1 100644 --- a/tests/unit/dialog/dialog.html +++ b/tests/unit/dialog/dialog.html @@ -38,7 +38,7 @@ <ol id="qunit-tests"> </ol> -<div id="main" style="position: absolute; top: -10000px; left: -10000px;"> +<div id="qunit-fixture"> </div> </body> diff --git a/tests/unit/draggable/draggable.html b/tests/unit/draggable/draggable.html index 9cd7a1155..351d751df 100644 --- a/tests/unit/draggable/draggable.html +++ b/tests/unit/draggable/draggable.html @@ -42,7 +42,7 @@ <ol id="qunit-tests"> </ol> -<div id="main" style="position: absolute; top: -10000px; left: -10000px;"> +<div id="qunit-fixture"> <div id="draggable1" style="background: green; width: 200px; height: 100px;">Relative</div> <div id="draggable2" style="background: green; width: 200px; height: 100px; position: absolute; top: 10px; left: 10px;"><span>Absolute</span></div> <div style='width: 1px; height: 1000px;'></div> diff --git a/tests/unit/droppable/droppable.html b/tests/unit/droppable/droppable.html index 669b93755..784ecca5f 100644 --- a/tests/unit/droppable/droppable.html +++ b/tests/unit/droppable/droppable.html @@ -43,7 +43,7 @@ <ol id="qunit-tests"> </ol> -<div id="main" style="position: absolute; top: -10000px; left: -10000px;"> +<div id="qunit-fixture"> <div id="draggable1" style="width: 25px; height: 25px;">Draggable</div> <div id="droppable1" style="width: 100px; height: 100px;">Droppable</div> <div style='width:1000px;height:1000px;'> </div> diff --git a/tests/unit/position/position.html b/tests/unit/position/position.html index 7dacff6c2..30d7d5508 100644 --- a/tests/unit/position/position.html +++ b/tests/unit/position/position.html @@ -29,7 +29,7 @@ elements smaller than 10px have a line-height set on them to avoid a bug in IE6 .height() returns the greater of the height and line-height --> -<div id="main" style="position: absolute; top: 0; left: 0;"> +<div id="qunit-fixtures"> <div id="el1" style="position: absolute; width: 6px; height: 6px; line-height: 6px;"></div> <div id="el2" style="position: absolute; width: 6px; height: 6px; line-height: 6px;"></div> <div id="parent" style="position: absolute; width: 6px; height: 6px; top: 4px; left: 4px; line-height: 6px;"></div> diff --git a/tests/unit/progressbar/progressbar.html b/tests/unit/progressbar/progressbar.html index 6b893ebe7..92b328058 100644 --- a/tests/unit/progressbar/progressbar.html +++ b/tests/unit/progressbar/progressbar.html @@ -33,7 +33,7 @@ <ol id="qunit-tests"> </ol> -<div id="main" style="position: absolute; top: -10000px; left: -10000px;"> +<div id="qunit-fixture"> <div id="progressbar"></div> </div> diff --git a/tests/unit/resizable/resizable.html b/tests/unit/resizable/resizable.html index 019dedd69..fdce085eb 100644 --- a/tests/unit/resizable/resizable.html +++ b/tests/unit/resizable/resizable.html @@ -44,7 +44,7 @@ <ol id="qunit-tests"> </ol> -<div id="main" style="position: absolute; top: -10000px; left: -10000px;"> +<div id="qunit-fixture"> <div id="resizable1" style="background: green; width: 100px; height: 100px;">I'm a resizable.</div> <img src="images/test.jpg" id="resizable2" style="width: 100px; height: 100px;"/> </div> diff --git a/tests/unit/selectable/selectable.html b/tests/unit/selectable/selectable.html index 56184fbcf..b4ed616db 100644 --- a/tests/unit/selectable/selectable.html +++ b/tests/unit/selectable/selectable.html @@ -42,7 +42,7 @@ <ol id="qunit-tests"> </ol> -<div id="main" style="position: absolute; top: -10000px; left: -10000px;"> +<div id="qunit-fixture"> <ul id="selectable1"> <li>Item 1</li> <li>Item 2</li> diff --git a/tests/unit/slider/slider.html b/tests/unit/slider/slider.html index 7497e3a97..186719442 100644 --- a/tests/unit/slider/slider.html +++ b/tests/unit/slider/slider.html @@ -44,7 +44,7 @@ <ol id="qunit-tests"> </ol> -<div id="main" style="position: absolute; top: -10000px; left: -10000px;"> +<div id="qunit-fixture"> <div id="slider1"></div> <div id="slider3" style="position: relative; margin: 40px; width: 217px; height: 28px;"> <div class="ui-slider-handle" style="position: absolute; height: 21px; left: 0px; bottom: 0px; width: 17px;"></div> diff --git a/tests/unit/sortable/sortable.html b/tests/unit/sortable/sortable.html index 9d2206e60..c25c274b1 100644 --- a/tests/unit/sortable/sortable.html +++ b/tests/unit/sortable/sortable.html @@ -42,7 +42,7 @@ <ol id="qunit-tests"> </ol> -<div id="main" style="position: absolute; top: -10000px; left: -10000px;"> +<div id="qunit-fixture"> <ul id="sortable"> <li>Item 1</li> <li>Item 2</li> diff --git a/tests/unit/tabs/tabs.html b/tests/unit/tabs/tabs.html index c58ea5cc3..31e506aba 100644 --- a/tests/unit/tabs/tabs.html +++ b/tests/unit/tabs/tabs.html @@ -44,7 +44,7 @@ <ol id="qunit-tests"> </ol> -<div id="main" style="position: absolute; top: -10000px; left: -10000px;"> +<div id="qunit-fixture"> <div id="tabs1"> <ul> diff --git a/tests/unit/testsuites.js b/tests/unit/testsuites.js new file mode 100644 index 000000000..ffe2d3cc0 --- /dev/null +++ b/tests/unit/testsuites.js @@ -0,0 +1,76 @@ +(function( $, QUnit ) { + +$.extend( QUnit, { + testSuites: function( suites ) { + $.each( suites, function( i, suite ) { + asyncTest( suite, function() { + runSuite( suite ); + }); + }); + }, + + testStart: function( data ) { + // update the test status to show which test suite is running + $( "#qunit-testresult" ).html( "Running " + data.name + "...<br> " ); + }, + + testDone: function() { + // undo the auto-expansion of failed tests + $( "#qunit-tests > li.fail" ).each(function() { + var test = $( this ); + // avoid collapsing test results that the user manually opened + if ( test.data( "auto-collapsed" ) ) { + return; + } + test.data( "auto-collapsed", true ) + .children( "ol" ).hide(); + }); + } +}); + +// generate an iframe to run the test suite and proxy the iframe's QUnit +// to pass all test info to the main page +function runSuite( suite ) { + var body = $( "body" ), + iframe = $( "<iframe>", { src: suite } ) + .css({ + width: 1000, + height: 1000 + }) + .appendTo( body ) + [0], + iframeWin = iframe.contentWindow; + + $( iframeWin ).bind( "load", function() { + var module, test, + count = 0; + + $.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() { + // hide the iframe from the main page once the tests are done + // and start the wrapper test from the main page + $( iframe ).hide(); + start(); + } + }); + }); +} + +}( jQuery, QUnit ) ); diff --git a/tests/unit/widget/widget.html b/tests/unit/widget/widget.html index 76a9f1d9e..f5bbd81d9 100644 --- a/tests/unit/widget/widget.html +++ b/tests/unit/widget/widget.html @@ -26,7 +26,7 @@ <ol id="qunit-tests"> </ol> -<div id="main" style="position: absolute; top: -10000px; left: -10000px;"> +<div id="qunit-fixture"> <div id="widget-wrapper"> <div id="widget"> |