diff options
author | Scott González <scott.gonzalez@gmail.com> | 2012-04-23 10:43:01 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-04-23 10:43:01 -0400 |
commit | b042f8ebd68e21155edb090917051353fe7a0162 (patch) | |
tree | 1d6dc4dad3b5dabb1ad971bca72d8f4bc3b4c99a | |
parent | 7a5a77da50e5e2401043410434c49971ce504653 (diff) | |
download | jquery-ui-b042f8ebd68e21155edb090917051353fe7a0162.tar.gz jquery-ui-b042f8ebd68e21155edb090917051353fe7a0162.zip |
Tests: Moved loadResources to TestHelpers.
25 files changed, 145 insertions, 209 deletions
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( "<link rel='stylesheet' href='../../../" + url + "'>" ); -} - -function includeScript( url ) { - document.write( "<script src='../../../" + url + "'></script>" ); -} - -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 @@ <script> $.uiBackCompat = false; </script> - <script src="../../resource_loader.js"></script> + <link rel="stylesheet" href="../../../external/qunit.css"> + <script src="../../../external/qunit.js"></script> + <script src="../../jquery.simulate.js"></script> + <script src="../testsuite.js"></script> <script> - loadResources({ + TestHelpers.loadResources({ css: [ "ui.core", "ui.accordion" ], js: [ "ui/jquery.ui.core.js", @@ -20,11 +23,6 @@ }); </script> - <link rel="stylesheet" href="../../../external/qunit.css"> - <script src="../../../external/qunit.js"></script> - <script src="../../jquery.simulate.js"></script> - <script src="../testsuite.js"></script> - <script src="accordion_test_helpers.js"></script> <script src="accordion_common.js"></script> <script src="accordion_core.js"></script> 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 @@ <title>jQuery UI Accordion Test Suite</title> <script src="../../jquery.js"></script> - <script src="../../resource_loader.js"></script> + <link rel="stylesheet" href="../../../external/qunit.css"> + <script src="../../../external/qunit.js"></script> + <script src="../../jquery.simulate.js"></script> + <script src="../testsuite.js"></script> <script> - loadResources({ + TestHelpers.loadResources({ css: [ "ui.core", "ui.accordion" ], js: [ "ui/jquery.ui.core.js", @@ -17,11 +20,6 @@ }); </script> - <link rel="stylesheet" href="../../../external/qunit.css"> - <script src="../../../external/qunit.js"></script> - <script src="../../jquery.simulate.js"></script> - <script src="../testsuite.js"></script> - <script src="accordion_test_helpers.js"></script> <script src="accordion_common_deprecated.js"></script> <script src="accordion_core.js"></script> 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 @@ <title>jQuery UI Autocomplete Test Suite</title> <script src="../../jquery.js"></script> - <script src="../../resource_loader.js"></script> + <link rel="stylesheet" href="../../../external/qunit.css"> + <script src="../../../external/qunit.js"></script> + <script src="../../jquery.simulate.js"></script> + <script src="../testsuite.js"></script> <script> - loadResources({ + TestHelpers.loadResources({ css: [ "ui.core", "ui.menu", "ui.autocomplete" ], js: [ "ui/jquery.ui.core.js", @@ -19,11 +22,6 @@ }); </script> - <link rel="stylesheet" href="../../../external/qunit.css"> - <script src="../../../external/qunit.js"></script> - <script src="../../jquery.simulate.js"></script> - <script src="../testsuite.js"></script> - <script src="autocomplete_common.js"></script> <script src="autocomplete_core.js"></script> <script src="autocomplete_events.js"></script> 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 @@ <title>jQuery UI Button Test Suite</title> <script src="../../jquery.js"></script> - <script src="../../resource_loader.js"></script> + <link rel="stylesheet" href="../../../external/qunit.css"> + <script src="../../../external/qunit.js"></script> + <script src="../../jquery.simulate.js"></script> + <script src="../testsuite.js"></script> <script> - loadResources({ + TestHelpers.loadResources({ css: [ "ui.core", "ui.button" ], js: [ "ui/jquery.ui.core.js", @@ -17,11 +20,6 @@ }); </script> - <link rel="stylesheet" href="../../../external/qunit.css"> - <script src="../../../external/qunit.js"></script> - <script src="../../jquery.simulate.js"></script> - <script src="../testsuite.js"></script> - <script src="button_common.js"></script> <script src="button_core.js"></script> <script src="button_events.js"></script> 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 @@ <title>jQuery UI Core Test Suite</title> <script src="../../jquery.js"></script> - <script src="../../resource_loader.js"></script> - <script> - loadResources({ - js: [ "ui/jquery.ui.core.js" ] - }); - </script> - <link rel="stylesheet" href="../../../external/qunit.css"> <script src="../../../external/qunit.js"></script> <script src="../../jquery.simulate.js"></script> <script src="../testsuite.js"></script> + <script> + TestHelpers.loadResources({ + js: [ "ui/jquery.ui.core.js" ] + }); + </script> <script src="core.js"></script> <script src="selector.js"></script> 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 @@ <title>jQuery UI Datepicker Test Suite</title> <script src="../../jquery.js"></script> - <script src="../../resource_loader.js"></script> + <link rel="stylesheet" href="../../../external/qunit.css"> + <script src="../../../external/qunit.js"></script> + <script src="../../jquery.simulate.js"></script> + <script src="../testsuite.js"></script> <script> - loadResources({ + TestHelpers.loadResources({ css: [ "ui.core", "ui.datepicker" ], js: [ "ui/jquery.ui.core.js", @@ -19,11 +22,6 @@ }); </script> - <link rel="stylesheet" href="../../../external/qunit.css"> - <script src="../../../external/qunit.js"></script> - <script src="../../jquery.simulate.js"></script> - <script src="../testsuite.js"></script> - <script src="datepicker_core.js"></script> <script src="datepicker_defaults.js"></script> <script src="datepicker_events.js"></script> 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 @@ <script src="../../jquery.js"></script> <script src="../../../external/jquery.bgiframe-2.1.2.js"></script> - <script src="../../resource_loader.js"></script> + <link rel="stylesheet" href="../../../external/qunit.css"> + <script src="../../../external/qunit.js"></script> + <script src="../../jquery.simulate.js"></script> + <script src="../testsuite.js"></script> <script> - loadResources({ + TestHelpers.loadResources({ css: [ "ui.core", "ui.dialog" ], js: [ "ui/jquery.ui.core.js", @@ -22,11 +25,6 @@ }); </script> - <link rel="stylesheet" href="../../../external/qunit.css"> - <script src="../../../external/qunit.js"></script> - <script src="../../jquery.simulate.js"></script> - <script src="../testsuite.js"></script> - <script src="dialog_common.js"></script> <script src="dialog_core.js"></script> <script src="dialog_events.js"></script> 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 @@ <title>jQuery UI Draggable Test Suite</title> <script src="../../jquery.js"></script> - <script src="../../resource_loader.js"></script> + <link rel="stylesheet" href="../../../external/qunit.css"> + <script src="../../../external/qunit.js"></script> + <script src="../../jquery.simulate.js"></script> + <script src="../testsuite.js"></script> <script> - loadResources({ + TestHelpers.loadResources({ css: [ "ui.core" ], js: [ "ui/jquery.ui.core.js", @@ -18,11 +21,6 @@ }); </script> - <link rel="stylesheet" href="../../../external/qunit.css"> - <script src="../../../external/qunit.js"></script> - <script src="../../jquery.simulate.js"></script> - <script src="../testsuite.js"></script> - <script src="draggable_common.js"></script> <script src="draggable_core.js"></script> <script src="draggable_events.js"></script> 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 @@ <title>jQuery UI Droppable Test Suite</title> <script src="../../jquery.js"></script> - <script src="../../resource_loader.js"></script> + <link rel="stylesheet" href="../../../external/qunit.css"> + <script src="../../../external/qunit.js"></script> + <script src="../../jquery.simulate.js"></script> + <script src="../testsuite.js"></script> <script> - loadResources({ + TestHelpers.loadResources({ css: [ "ui.core" ], js: [ "ui/jquery.ui.core.js", @@ -19,11 +22,6 @@ }); </script> - <link rel="stylesheet" href="../../../external/qunit.css"> - <script src="../../../external/qunit.js"></script> - <script src="../../jquery.simulate.js"></script> - <script src="../testsuite.js"></script> - <script src="droppable_common.js"></script> <script src="droppable_core.js"></script> <script src="droppable_events.js"></script> 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 @@ <script> $.uiBackCompat = false; </script> - <script src="../../resource_loader.js"></script> + <link rel="stylesheet" href="../../../external/qunit.css"> + <script src="../../../external/qunit.js"></script> + <script src="../../jquery.simulate.js"></script> + <script src="../testsuite.js"></script> <script> - loadResources({ + TestHelpers.loadResources({ js: [ "ui/jquery.effects.core.js", "ui/jquery.effects.blind.js", @@ -30,10 +33,6 @@ }); </script> - <link rel="stylesheet" href="../../../external/qunit.css"> - <script src="../../../external/qunit.js"></script> - <script src="../../jquery.simulate.js"></script> - <script src="../testsuite.js"></script> <script src="effects_core.js"></script> <script src="effects_scale.js"></script> 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 @@ <title>jQuery UI Menu Test Suite</title> <script src="../../jquery.js"></script> - <script src="../../resource_loader.js"></script> + <link rel="stylesheet" href="../../../external/qunit.css"> + <script src="../../../external/qunit.js"></script> + <script src="../../jquery.simulate.js"></script> + <script src="../testsuite.js"></script> <script> - loadResources({ + TestHelpers.loadResources({ css: [ "ui.core", "ui.menu" ], js: [ "ui/jquery.ui.core.js", @@ -17,11 +20,6 @@ }); </script> - <link rel="stylesheet" href="../../../external/qunit.css"> - <script src="../../../external/qunit.js"></script> - <script src="../../jquery.simulate.js"></script> - <script src="../testsuite.js"></script> - <script src="menu_test_helpers.js"></script> <script src="menu_common.js"></script> <script src="menu_core.js"></script> 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 @@ <script> $.uiBackCompat = false; </script> - <script src="../../resource_loader.js"></script> - <script> - loadResources({ - js: [ "ui/jquery.ui.position.js" ] - }); - </script> - <link rel="stylesheet" href="../../../external/qunit.css"> <script src="../../../external/qunit.js"></script> <script src="../../jquery.simulate.js"></script> <script src="../testsuite.js"></script> + <script> + TestHelpers.loadResources({ + js: [ "ui/jquery.ui.position.js" ] + }); + </script> <script src="position_core.js"></script> <script src="position_core_within.js"></script> 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 @@ <title>jQuery UI Position Test Suite</title> <script src="../../jquery.js"></script> - <script src="../../resource_loader.js"></script> - <script> - loadResources({ - js: [ "ui/jquery.ui.position.js" ] - }); - </script> - <link rel="stylesheet" href="../../../external/qunit.css"> <script src="../../../external/qunit.js"></script> <script src="../../jquery.simulate.js"></script> <script src="../testsuite.js"></script> + <script> + TestHelpers.loadResources({ + js: [ "ui/jquery.ui.position.js" ] + }); + </script> <script src="position_core.js"></script> <script src="position_deprecated.js"></script> 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 @@ <title>jQuery UI Progressbar Test Suite</title> <script src="../../jquery.js"></script> - <script src="../../resource_loader.js"></script> + <link rel="stylesheet" href="../../../external/qunit.css"> + <script src="../../../external/qunit.js"></script> + <script src="../../jquery.simulate.js"></script> + <script src="../testsuite.js"></script> <script> - loadResources({ + TestHelpers.loadResources({ css: [ "ui.core", "ui.progressbar" ], js: [ "ui/jquery.ui.core.js", @@ -17,11 +20,6 @@ }); </script> - <link rel="stylesheet" href="../../../external/qunit.css"> - <script src="../../../external/qunit.js"></script> - <script src="../../jquery.simulate.js"></script> - <script src="../testsuite.js"></script> - <script src="progressbar_common.js"></script> <script src="progressbar_core.js"></script> <script src="progressbar_events.js"></script> 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 @@ <title>jQuery UI Resizable Test Suite</title> <script src="../../jquery.js"></script> - <script src="../../resource_loader.js"></script> + <link rel="stylesheet" href="../../../external/qunit.css"> + <script src="../../../external/qunit.js"></script> + <script src="../../jquery.simulate.js"></script> + <script src="../testsuite.js"></script> <script> - loadResources({ + TestHelpers.loadResources({ css: [ "ui.core", "ui.resizable" ], js: [ "ui/jquery.ui.core.js", @@ -18,11 +21,6 @@ }); </script> - <link rel="stylesheet" href="../../../external/qunit.css"> - <script src="../../../external/qunit.js"></script> - <script src="../../jquery.simulate.js"></script> - <script src="../testsuite.js"></script> - <script src="resizable_common.js"></script> <script src="resizable_core.js"></script> <script src="resizable_events.js"></script> 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 @@ <title>jQuery UI Selectable Test Suite</title> <script src="../../jquery.js"></script> - <script src="../../resource_loader.js"></script> + <link rel="stylesheet" href="../../../external/qunit.css"> + <script src="../../../external/qunit.js"></script> + <script src="../../jquery.simulate.js"></script> + <script src="../testsuite.js"></script> <script> - loadResources({ + TestHelpers.loadResources({ css: [ "ui.core", "ui.selectable" ], js: [ "ui/jquery.ui.core.js", @@ -18,11 +21,6 @@ }); </script> - <link rel="stylesheet" href="../../../external/qunit.css"> - <script src="../../../external/qunit.js"></script> - <script src="../../jquery.simulate.js"></script> - <script src="../testsuite.js"></script> - <script src="selectable_common.js"></script> <script src="selectable_core.js"></script> <script src="selectable_events.js"></script> 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 @@ <title>jQuery UI Slider Test Suite</title> <script src="../../jquery.js"></script> - <script src="../../resource_loader.js"></script> + <link rel="stylesheet" href="../../../external/qunit.css"> + <script src="../../../external/qunit.js"></script> + <script src="../../jquery.simulate.js"></script> + <script src="../testsuite.js"></script> <script> - loadResources({ + TestHelpers.loadResources({ css: [ "ui.core", "ui.slider" ], js: [ "ui/jquery.ui.core.js", @@ -18,11 +21,6 @@ }); </script> - <link rel="stylesheet" href="../../../external/qunit.css"> - <script src="../../../external/qunit.js"></script> - <script src="../../jquery.simulate.js"></script> - <script src="../testsuite.js"></script> - <script src="slider_common.js"></script> <script src="slider_core.js"></script> <script src="slider_events.js"></script> 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 @@ <title>jQuery UI Sortable Test Suite</title> <script src="../../jquery.js"></script> - <script src="../../resource_loader.js"></script> + <link rel="stylesheet" href="../../../external/qunit.css"> + <script src="../../../external/qunit.js"></script> + <script src="../../jquery.simulate.js"></script> + <script src="../testsuite.js"></script> <script> - loadResources({ + TestHelpers.loadResources({ css: [ "ui.core", "ui.sortable" ], js: [ "ui/jquery.ui.core.js", @@ -18,11 +21,6 @@ }); </script> - <link rel="stylesheet" href="../../../external/qunit.css"> - <script src="../../../external/qunit.js"></script> - <script src="../../jquery.simulate.js"></script> - <script src="../testsuite.js"></script> - <script src="sortable_common.js"></script> <script src="sortable_core.js"></script> <script src="sortable_events.js"></script> 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 @@ <script src="../../../external/jquery.mousewheel-3.0.4.js"></script> <script src="../../../external/globalize.js"></script> <script src="../../../external/globalize.culture.ja-JP.js"></script> - <script src="../../resource_loader.js"></script> + <link rel="stylesheet" href="../../../external/qunit.css"> + <script src="../../../external/qunit.js"></script> + <script src="../../jquery.simulate.js"></script> + <script src="../testsuite.js"></script> <script> - loadResources({ + TestHelpers.loadResources({ css: [ "ui.core", "ui.button", "ui.spinner" ], js: [ "ui/jquery.ui.core.js", @@ -21,11 +24,6 @@ }); </script> - <link rel="stylesheet" href="../../../external/qunit.css"> - <script src="../../../external/qunit.js"></script> - <script src="../../jquery.simulate.js"></script> - <script src="../testsuite.js"></script> - <script src="spinner_test_helpers.js"></script> <script src="spinner_common.js"></script> <script src="spinner_core.js"></script> 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 @@ <script> $.uiBackCompat = false; </script> - <script src="../../resource_loader.js"></script> + <link rel="stylesheet" href="../../../external/qunit.css"> + <script src="../../../external/qunit.js"></script> + <script src="../../jquery.simulate.js"></script> + <script src="../testsuite.js"></script> <script> - loadResources({ + TestHelpers.loadResources({ css: [ "ui.core", "ui.tabs" ], js: [ "ui/jquery.ui.core.js", @@ -20,11 +23,6 @@ }); </script> - <link rel="stylesheet" href="../../../external/qunit.css"> - <script src="../../../external/qunit.js"></script> - <script src="../../jquery.simulate.js"></script> - <script src="../testsuite.js"></script> - <script src="tabs_test_helpers.js"></script> <script src="tabs_common.js"></script> <script src="tabs_core.js"></script> 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 @@ <script src="../../jquery.js"></script> <script src="../../../external/jquery.cookie.js"></script> - <script src="../../resource_loader.js"></script> + <link rel="stylesheet" href="../../../external/qunit.css"> + <script src="../../../external/qunit.js"></script> + <script src="../../jquery.simulate.js"></script> + <script src="../testsuite.js"></script> <script> - loadResources({ + TestHelpers.loadResources({ css: [ "ui.core", "ui.tabs" ], js: [ "ui/jquery.ui.core.js", @@ -18,11 +21,6 @@ }); </script> - <link rel="stylesheet" href="../../../external/qunit.css"> - <script src="../../../external/qunit.js"></script> - <script src="../../jquery.simulate.js"></script> - <script src="../testsuite.js"></script> - <script src="tabs_test_helpers.js"></script> <script src="tabs_common_deprecated.js"></script> <script src="tabs_core.js"></script> 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( "<link rel='stylesheet' href='../../../" + url + "'>" ); +} + +function includeScript( url ) { + document.write( "<script src='../../../" + url + "'></script>" ); +} + +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( "<script src='../../../external/jshint.js'></script>" ); + 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 @@ <title>jQuery UI Tooltip Test Suite</title> <script src="../../jquery.js"></script> - <script src="../../resource_loader.js"></script> + <link rel="stylesheet" href="../../../external/qunit.css"> + <script src="../../../external/qunit.js"></script> + <script src="../../jquery.simulate.js"></script> + <script src="../testsuite.js"></script> <script> - loadResources({ + TestHelpers.loadResources({ css: [ "ui.core", "ui.tooltip" ], js: [ "ui/jquery.ui.core.js", @@ -18,11 +21,6 @@ }); </script> - <link rel="stylesheet" href="../../../external/qunit.css"> - <script src="../../../external/qunit.js"></script> - <script src="../../jquery.simulate.js"></script> - <script src="../testsuite.js"></script> - <script src="tooltip_common.js"></script> <script src="tooltip_core.js"></script> <script src="tooltip_events.js"></script> 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 @@ <title>jQuery UI Widget Test Suite</title> <script src="../../jquery.js"></script> - <script src="../../resource_loader.js"></script> + <link rel="stylesheet" href="../../../external/qunit.css"> + <script src="../../../external/qunit.js"></script> + <script src="../../jquery.simulate.js"></script> + <script src="../testsuite.js"></script> <script> - loadResources({ + TestHelpers.loadResources({ css: [ "ui.core" ], js: [ "ui/jquery.ui.widget.js" @@ -15,11 +18,6 @@ }); </script> - <link rel="stylesheet" href="../../../external/qunit.css"> - <script src="../../../external/qunit.js"></script> - <script src="../../jquery.simulate.js"></script> - <script src="../testsuite.js"></script> - <script src="widget_core.js"></script> <script src="widget_extend.js"></script> <script src="widget_animation.js"></script> |