From b042f8ebd68e21155edb090917051353fe7a0162 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Scott=20Gonz=C3=A1lez?= Date: Mon, 23 Apr 2012 10:43:01 -0400 Subject: [PATCH] Tests: Moved loadResources to TestHelpers. --- tests/resource_loader.js | 40 ------------------- tests/unit/accordion/accordion.html | 12 +++--- .../unit/accordion/accordion_deprecated.html | 12 +++--- tests/unit/autocomplete/autocomplete.html | 12 +++--- tests/unit/button/button.html | 12 +++--- tests/unit/core/core.html | 12 +++--- tests/unit/datepicker/datepicker.html | 12 +++--- tests/unit/dialog/dialog.html | 12 +++--- tests/unit/draggable/draggable.html | 12 +++--- tests/unit/droppable/droppable.html | 12 +++--- tests/unit/effects/effects.html | 11 +++-- tests/unit/menu/menu.html | 12 +++--- tests/unit/position/position.html | 12 +++--- tests/unit/position/position_deprecated.html | 12 +++--- tests/unit/progressbar/progressbar.html | 12 +++--- tests/unit/resizable/resizable.html | 12 +++--- tests/unit/selectable/selectable.html | 12 +++--- tests/unit/slider/slider.html | 12 +++--- tests/unit/sortable/sortable.html | 12 +++--- tests/unit/spinner/spinner.html | 12 +++--- tests/unit/tabs/tabs.html | 12 +++--- tests/unit/tabs/tabs_deprecated.html | 12 +++--- tests/unit/testsuite.js | 39 +++++++++++++----- tests/unit/tooltip/tooltip.html | 12 +++--- tests/unit/widget/widget.html | 12 +++--- 25 files changed, 145 insertions(+), 209 deletions(-) delete mode 100644 tests/resource_loader.js diff --git a/tests/resource_loader.js b/tests/resource_loader.js deleted file mode 100644 index 9a03411a2..000000000 --- a/tests/resource_loader.js +++ /dev/null @@ -1,40 +0,0 @@ -(function( $ ) { - -var parts = document.location.search.slice( 1 ).split( "&" ), - length = parts.length, - i = 0, - current, - min; - -for ( ; i < length; i++ ) { - current = parts[ i ].split( "=" ); - if ( current[ 0 ] === "min" ) { - min = current[ 1 ]; - break; - } -} - -function includeStyle( url ) { - document.write( "" ); -} - -function includeScript( url ) { - document.write( "" ); -} - -window.loadResources = min ? - function() { - // TODO: proper include with theme images - includeStyle( "dist/jquery-ui.min.css" ); - includeScript( "dist/jquery-ui.min.js" ); - } : - function( resources ) { - $.each( resources.css || [], function( i, resource ) { - includeStyle( "themes/base/jquery." + resource + ".css" ); - }); - $.each( resources.js || [], function( i, resource ) { - includeScript( resource ); - }); - }; - -})( jQuery ); diff --git a/tests/unit/accordion/accordion.html b/tests/unit/accordion/accordion.html index ec7839019..b3b7caeae 100644 --- a/tests/unit/accordion/accordion.html +++ b/tests/unit/accordion/accordion.html @@ -8,9 +8,12 @@ - + + + + - - - - - diff --git a/tests/unit/accordion/accordion_deprecated.html b/tests/unit/accordion/accordion_deprecated.html index f3494c6fc..dfb9fa90e 100644 --- a/tests/unit/accordion/accordion_deprecated.html +++ b/tests/unit/accordion/accordion_deprecated.html @@ -5,9 +5,12 @@ jQuery UI Accordion Test Suite - + + + + - - - - - diff --git a/tests/unit/autocomplete/autocomplete.html b/tests/unit/autocomplete/autocomplete.html index 259def349..571c62033 100644 --- a/tests/unit/autocomplete/autocomplete.html +++ b/tests/unit/autocomplete/autocomplete.html @@ -5,9 +5,12 @@ jQuery UI Autocomplete Test Suite - + + + + - - - - - diff --git a/tests/unit/button/button.html b/tests/unit/button/button.html index 5f27740c4..b79ca1dc6 100644 --- a/tests/unit/button/button.html +++ b/tests/unit/button/button.html @@ -5,9 +5,12 @@ jQuery UI Button Test Suite - + + + + - - - - - diff --git a/tests/unit/core/core.html b/tests/unit/core/core.html index 3b1dc1fc8..3baf852bb 100644 --- a/tests/unit/core/core.html +++ b/tests/unit/core/core.html @@ -5,17 +5,15 @@ jQuery UI Core Test Suite - - - + diff --git a/tests/unit/datepicker/datepicker.html b/tests/unit/datepicker/datepicker.html index 592db53cc..bfff32d32 100644 --- a/tests/unit/datepicker/datepicker.html +++ b/tests/unit/datepicker/datepicker.html @@ -5,9 +5,12 @@ jQuery UI Datepicker Test Suite - + + + + - - - - - diff --git a/tests/unit/dialog/dialog.html b/tests/unit/dialog/dialog.html index 1f940400c..d804807f2 100644 --- a/tests/unit/dialog/dialog.html +++ b/tests/unit/dialog/dialog.html @@ -6,9 +6,12 @@ - + + + + - - - - - diff --git a/tests/unit/draggable/draggable.html b/tests/unit/draggable/draggable.html index acc50effe..09bc191c9 100644 --- a/tests/unit/draggable/draggable.html +++ b/tests/unit/draggable/draggable.html @@ -5,9 +5,12 @@ jQuery UI Draggable Test Suite - + + + + - - - - - diff --git a/tests/unit/droppable/droppable.html b/tests/unit/droppable/droppable.html index eb2215763..49ebf6beb 100644 --- a/tests/unit/droppable/droppable.html +++ b/tests/unit/droppable/droppable.html @@ -5,9 +5,12 @@ jQuery UI Droppable Test Suite - + + + + - - - - - diff --git a/tests/unit/effects/effects.html b/tests/unit/effects/effects.html index 06023c55d..1fd94182d 100644 --- a/tests/unit/effects/effects.html +++ b/tests/unit/effects/effects.html @@ -8,9 +8,12 @@ - + + + + - - - - diff --git a/tests/unit/menu/menu.html b/tests/unit/menu/menu.html index 54a2ecaa0..fca45697f 100644 --- a/tests/unit/menu/menu.html +++ b/tests/unit/menu/menu.html @@ -5,9 +5,12 @@ jQuery UI Menu Test Suite - + + + + - - - - - diff --git a/tests/unit/position/position.html b/tests/unit/position/position.html index 115adc3e9..3ea7750d7 100644 --- a/tests/unit/position/position.html +++ b/tests/unit/position/position.html @@ -8,17 +8,15 @@ - - - + diff --git a/tests/unit/position/position_deprecated.html b/tests/unit/position/position_deprecated.html index ee9be189d..c7a9b6bce 100644 --- a/tests/unit/position/position_deprecated.html +++ b/tests/unit/position/position_deprecated.html @@ -5,17 +5,15 @@ jQuery UI Position Test Suite - - - + diff --git a/tests/unit/progressbar/progressbar.html b/tests/unit/progressbar/progressbar.html index f6156d0bb..70a4abe56 100644 --- a/tests/unit/progressbar/progressbar.html +++ b/tests/unit/progressbar/progressbar.html @@ -5,9 +5,12 @@ jQuery UI Progressbar Test Suite - + + + + - - - - - diff --git a/tests/unit/resizable/resizable.html b/tests/unit/resizable/resizable.html index 028087842..9baa67493 100644 --- a/tests/unit/resizable/resizable.html +++ b/tests/unit/resizable/resizable.html @@ -5,9 +5,12 @@ jQuery UI Resizable Test Suite - + + + + - - - - - diff --git a/tests/unit/selectable/selectable.html b/tests/unit/selectable/selectable.html index af4e6d20e..7b0ca6ffe 100644 --- a/tests/unit/selectable/selectable.html +++ b/tests/unit/selectable/selectable.html @@ -5,9 +5,12 @@ jQuery UI Selectable Test Suite - + + + + - - - - - diff --git a/tests/unit/slider/slider.html b/tests/unit/slider/slider.html index a63196219..3aec78b4b 100644 --- a/tests/unit/slider/slider.html +++ b/tests/unit/slider/slider.html @@ -5,9 +5,12 @@ jQuery UI Slider Test Suite - + + + + - - - - - diff --git a/tests/unit/sortable/sortable.html b/tests/unit/sortable/sortable.html index 4ed4f92ce..c84c62197 100644 --- a/tests/unit/sortable/sortable.html +++ b/tests/unit/sortable/sortable.html @@ -5,9 +5,12 @@ jQuery UI Sortable Test Suite - + + + + - - - - - diff --git a/tests/unit/spinner/spinner.html b/tests/unit/spinner/spinner.html index e495abe1b..b7f4a532a 100644 --- a/tests/unit/spinner/spinner.html +++ b/tests/unit/spinner/spinner.html @@ -8,9 +8,12 @@ - + + + + - - - - - diff --git a/tests/unit/tabs/tabs.html b/tests/unit/tabs/tabs.html index a79d30e0e..fc7bfeedf 100644 --- a/tests/unit/tabs/tabs.html +++ b/tests/unit/tabs/tabs.html @@ -8,9 +8,12 @@ - + + + + - - - - - diff --git a/tests/unit/tabs/tabs_deprecated.html b/tests/unit/tabs/tabs_deprecated.html index 9bb8e413e..0c7611c9d 100644 --- a/tests/unit/tabs/tabs_deprecated.html +++ b/tests/unit/tabs/tabs_deprecated.html @@ -6,9 +6,12 @@ - + + + + - - - - - diff --git a/tests/unit/testsuite.js b/tests/unit/testsuite.js index 70d035684..6720000f1 100644 --- a/tests/unit/testsuite.js +++ b/tests/unit/testsuite.js @@ -2,12 +2,35 @@ window.TestHelpers = {}; +function includeStyle( url ) { + document.write( "" ); +} + +function includeScript( url ) { + document.write( "" ); +} + +TestHelpers.loadResources = QUnit.urlParams.min ? + function() { + // TODO: proper include with theme images + includeStyle( "dist/jquery-ui.min.css" ); + includeScript( "dist/jquery-ui.min.js" ); + } : + function( resources ) { + $.each( resources.css || [], function( i, resource ) { + includeStyle( "themes/base/jquery." + resource + ".css" ); + }); + $.each( resources.js || [], function( i, resource ) { + includeScript( resource ); + }); + }; + function testJshint( widget ) { if ( QUnit.urlParams.nojshint ) { return; } - document.write( "" ); + includeScript( "external/jshint.js" ); asyncTest( "JSHint", function() { expect( 1 ); @@ -58,17 +81,15 @@ function testWidgetDefaults( widget, defaults ) { }); } -var privateMethods = [ - "_createWidget", - "destroy", - "option", - "_trigger" -]; - function testWidgetOverrides( widget ) { if ( $.uiBackCompat === false ) { test( "$.widget overrides", function() { - $.each( privateMethods, function( i, method ) { + $.each([ + "_createWidget", + "destroy", + "option", + "_trigger" + ], function( i, method ) { strictEqual( $.ui[ widget ].prototype[ method ], $.Widget.prototype[ method ], "should not override " + method ); }); diff --git a/tests/unit/tooltip/tooltip.html b/tests/unit/tooltip/tooltip.html index d1f54d544..d20ba8578 100644 --- a/tests/unit/tooltip/tooltip.html +++ b/tests/unit/tooltip/tooltip.html @@ -5,9 +5,12 @@ jQuery UI Tooltip Test Suite - + + + + - - - - - diff --git a/tests/unit/widget/widget.html b/tests/unit/widget/widget.html index 6f4caaa6c..15eaee6aa 100644 --- a/tests/unit/widget/widget.html +++ b/tests/unit/widget/widget.html @@ -5,9 +5,12 @@ jQuery UI Widget Test Suite - + + + + - - - - - -- 2.39.5