diff options
author | Scott González <scott.gonzalez@gmail.com> | 2015-04-17 12:13:38 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2015-04-17 12:13:38 -0400 |
commit | 6231b161b92d28bdb6657cdd1f7d11436e6b132d (patch) | |
tree | f5e4855b709195a920acedaed0fcfdfe74ad8596 | |
parent | 45797b9b4166a4d2e883cea9712e075bb484e337 (diff) | |
download | jquery-ui-6231b161b92d28bdb6657cdd1f7d11436e6b132d.tar.gz jquery-ui-6231b161b92d28bdb6657cdd1f7d11436e6b132d.zip |
Tests: Fix AMD loading in IE8
It appears that we must load require.js via a standard script tag in order
for it to work properly in IE8.
27 files changed, 44 insertions, 25 deletions
diff --git a/Gruntfile.js b/Gruntfile.js index f1fb6c5d7..1040ebe27 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -239,7 +239,8 @@ grunt.initConfig({ "ui/*.js", "Gruntfile.js", "build/**/*.js", - "tests/unit/**/*.js" + "tests/unit/**/*.js", + "tests/lib/**/*.js" ] }, csslint: { diff --git a/tests/.jshintrc b/tests/.jshintrc index 25c688b79..04d5371fc 100644 --- a/tests/.jshintrc +++ b/tests/.jshintrc @@ -6,7 +6,6 @@ "expr": true, "immed": true, "noarg": true, - "onevar": true, "quotmark": "double", "smarttabs": true, "trailing": true, @@ -31,6 +30,8 @@ "notStrictEqual": false, "ok": false, "QUnit": true, + "require": true, + "requirejs": true, "start": false, "strictEqual": false, "stop": false, diff --git a/tests/lib/bootstrap.js b/tests/lib/bootstrap.js index 7ca1bbda7..a381394a8 100644 --- a/tests/lib/bootstrap.js +++ b/tests/lib/bootstrap.js @@ -1,6 +1,6 @@ ( function() { -window.requirejs = { +requirejs.config({ paths: { "globalize": "../../../external/globalize/globalize", "globalize/ja-JP": "../../../external/globalize/globalize.culture.ja-JP", @@ -20,7 +20,19 @@ window.requirejs = { "qunit-assert-classes": [ "qunit" ], "qunit-assert-close": [ "qunit" ] } -}; +}); + +// Create a module that disables back compat for UI modules +define( "jquery-no-back-compat", [ "jquery" ], function( $ ) { + $.uiBackCompat = false; + + return $; +} ); + +// Create a dummy bridge if we're not actually testing in PhantomJS +if ( !/PhantomJS/.test( navigator.userAgent ) ) { + define( "phantom-bridge", function() {} ); +} // Load all modules in series function requireModules( dependencies, callback, modules ) { @@ -83,7 +95,7 @@ function jqueryUrl() { } return url; -}; +} function swarmInject() { var url = parseUrl().swarmURL; @@ -134,26 +146,7 @@ function swarmInject() { } } - // Load requirejs, then load the tests - script = document.createElement( "script" ); - script.src = "../../../external/requirejs/require.js"; - script.onload = function() { - - // Create a module that disables back compat for UI modules - define( "jquery-no-back-compat", [ "jquery" ], function( $ ) { - $.uiBackCompat = false; - - return $; - } ); - - // Create a dummy bridge if we're not actually testing in PhantomJS - if ( !/PhantomJS/.test( navigator.userAgent ) ) { - define( "phantom-bridge", function() {} ); - } - - requireTests( modules, noBackCompat ); - }; - document.documentElement.appendChild( script ); + requireTests( modules, noBackCompat ); } )(); } )(); diff --git a/tests/unit/accordion/accordion.html b/tests/unit/accordion/accordion.html index db206a2e5..683b87456 100644 --- a/tests/unit/accordion/accordion.html +++ b/tests/unit/accordion/accordion.html @@ -4,6 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Accordion Test Suite</title> + <script src="../../../external/requirejs/require.js"></script> <script src="../../lib/css.js" data-modules="core accordion"></script> <script src="../../lib/bootstrap.js" data-widget="accordion"></script> <style> diff --git a/tests/unit/autocomplete/autocomplete.html b/tests/unit/autocomplete/autocomplete.html index 90c8e8e97..484f2d957 100644 --- a/tests/unit/autocomplete/autocomplete.html +++ b/tests/unit/autocomplete/autocomplete.html @@ -4,6 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Autocomplete Test Suite</title> + <script src="../../../external/requirejs/require.js"></script> <script src="../../lib/css.js" data-modules="core menu autocomplete"></script> <script src="../../lib/bootstrap.js" data-widget="autocomplete"></script> </head> diff --git a/tests/unit/button/button.html b/tests/unit/button/button.html index df125867f..7ba400645 100644 --- a/tests/unit/button/button.html +++ b/tests/unit/button/button.html @@ -4,6 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Button Test Suite</title> + <script src="../../../external/requirejs/require.js"></script> <script src="../../lib/css.js" data-modules="core button"></script> <script src="../../lib/bootstrap.js" data-widget="button"></script> </head> diff --git a/tests/unit/core/core.html b/tests/unit/core/core.html index ae3a50370..354fd8b8e 100644 --- a/tests/unit/core/core.html +++ b/tests/unit/core/core.html @@ -4,6 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Core Test Suite</title> + <script src="../../../external/requirejs/require.js"></script> <script src="../../lib/css.js"></script> <script src="../../lib/bootstrap.js" data-modules="core selector"></script> <style> diff --git a/tests/unit/datepicker/datepicker.html b/tests/unit/datepicker/datepicker.html index a0df70d74..26d8de3e0 100644 --- a/tests/unit/datepicker/datepicker.html +++ b/tests/unit/datepicker/datepicker.html @@ -4,6 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Datepicker Test Suite</title> + <script src="../../../external/requirejs/require.js"></script> <script src="../../lib/css.js" data-modules="core datepicker"></script> <script src="../../lib/bootstrap.js" data-widget="datepicker"></script> </head> diff --git a/tests/unit/dialog/deprecated.html b/tests/unit/dialog/deprecated.html index 2d20b6291..50bab180d 100644 --- a/tests/unit/dialog/deprecated.html +++ b/tests/unit/dialog/deprecated.html @@ -4,6 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Dialog Test Suite</title> + <script src="../../../external/requirejs/require.js"></script> <script src="../../lib/css.js" data-modules="core button dialog"></script> <script src="../../lib/bootstrap.js" data-widget="dialog" data-deprecated="true"></script> </head> diff --git a/tests/unit/dialog/dialog.html b/tests/unit/dialog/dialog.html index aa0e3d3ec..bdba5e11c 100644 --- a/tests/unit/dialog/dialog.html +++ b/tests/unit/dialog/dialog.html @@ -4,6 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Dialog Test Suite</title> + <script src="../../../external/requirejs/require.js"></script> <script src="../../lib/css.js" data-modules="core button dialog"></script> <script src="../../lib/bootstrap.js" data-widget="dialog" data-no-back-compat="true"></script> </head> diff --git a/tests/unit/draggable/draggable.html b/tests/unit/draggable/draggable.html index 7ac6db388..0971b2325 100644 --- a/tests/unit/draggable/draggable.html +++ b/tests/unit/draggable/draggable.html @@ -4,6 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Draggable Test Suite</title> + <script src="../../../external/requirejs/require.js"></script> <script src="../../lib/css.js" data-modules="core"></script> <script src="../../lib/bootstrap.js" data-widget="draggable"></script> <style> diff --git a/tests/unit/droppable/deprecated.html b/tests/unit/droppable/deprecated.html index e47b41c6b..45bf1f460 100644 --- a/tests/unit/droppable/deprecated.html +++ b/tests/unit/droppable/deprecated.html @@ -4,6 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Droppable Test Suite</title> + <script src="../../../external/requirejs/require.js"></script> <script src="../../lib/css.js" data-modules="core"></script> <script src="../../lib/bootstrap.js" data-widget="droppable" data-deprecated="true"></script> </head> diff --git a/tests/unit/droppable/droppable.html b/tests/unit/droppable/droppable.html index 9021f8c78..5c3ec3dd9 100644 --- a/tests/unit/droppable/droppable.html +++ b/tests/unit/droppable/droppable.html @@ -4,6 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Droppable Test Suite</title> + <script src="../../../external/requirejs/require.js"></script> <script src="../../lib/css.js" data-modules="core"></script> <script src="../../lib/bootstrap.js" data-widget="droppable" data-no-back-compat="true"></script> diff --git a/tests/unit/effects/effects.html b/tests/unit/effects/effects.html index 91c31428c..b9ea802d0 100644 --- a/tests/unit/effects/effects.html +++ b/tests/unit/effects/effects.html @@ -4,6 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Effects Test Suite</title> + <script src="../../../external/requirejs/require.js"></script> <script src="../../lib/css.js"></script> <script src="../../lib/bootstrap.js" data-modules="core scale"> </script> diff --git a/tests/unit/menu/menu.html b/tests/unit/menu/menu.html index 5f11f4414..2d871a4b3 100644 --- a/tests/unit/menu/menu.html +++ b/tests/unit/menu/menu.html @@ -4,6 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Menu Test Suite</title> + <script src="../../../external/requirejs/require.js"></script> <script src="../../lib/css.js" data-modules="core menu"></script> <script src="../../lib/bootstrap.js" data-widget="menu"></script> <style> diff --git a/tests/unit/position/position.html b/tests/unit/position/position.html index e36ab5480..5f2a21532 100644 --- a/tests/unit/position/position.html +++ b/tests/unit/position/position.html @@ -4,6 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Position Test Suite</title> + <script src="../../../external/requirejs/require.js"></script> <script src="../../lib/css.js"></script> <script src="../../lib/bootstrap.js" data-modules="core"></script> </head> diff --git a/tests/unit/progressbar/progressbar.html b/tests/unit/progressbar/progressbar.html index 351ed4e21..18a5195bc 100644 --- a/tests/unit/progressbar/progressbar.html +++ b/tests/unit/progressbar/progressbar.html @@ -4,6 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Progressbar Test Suite</title> + <script src="../../../external/requirejs/require.js"></script> <script src="../../lib/css.js" data-modules="core progressbar"></script> <script src="../../lib/bootstrap.js" data-widget="progressbar"></script> </head> diff --git a/tests/unit/resizable/resizable.html b/tests/unit/resizable/resizable.html index 5190e5f5c..e3550f31f 100644 --- a/tests/unit/resizable/resizable.html +++ b/tests/unit/resizable/resizable.html @@ -4,6 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Resizable Test Suite</title> + <script src="../../../external/requirejs/require.js"></script> <script src="../../lib/css.js" data-modules="core resizable"></script> <script src="../../lib/bootstrap.js" data-widget="resizable"></script> <style> diff --git a/tests/unit/selectable/selectable.html b/tests/unit/selectable/selectable.html index 4486084e4..9cee000c0 100644 --- a/tests/unit/selectable/selectable.html +++ b/tests/unit/selectable/selectable.html @@ -4,6 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Selectable Test Suite</title> + <script src="../../../external/requirejs/require.js"></script> <script src="../../lib/css.js" data-modules="core selectable"></script> <script src="../../lib/bootstrap.js" data-widget="selectable"></script> </head> diff --git a/tests/unit/selectmenu/selectmenu.html b/tests/unit/selectmenu/selectmenu.html index 0583733a0..16e0f15a7 100644 --- a/tests/unit/selectmenu/selectmenu.html +++ b/tests/unit/selectmenu/selectmenu.html @@ -4,6 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Selectmenu Test Suite</title> + <script src="../../../external/requirejs/require.js"></script> <script src="../../lib/css.js" data-modules="core menu selectmenu"></script> <script src="../../lib/bootstrap.js" data-widget="selectmenu"></script> </head> diff --git a/tests/unit/slider/slider.html b/tests/unit/slider/slider.html index f19085fd4..a9ec5324f 100644 --- a/tests/unit/slider/slider.html +++ b/tests/unit/slider/slider.html @@ -4,6 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Slider Test Suite</title> + <script src="../../../external/requirejs/require.js"></script> <script src="../../lib/css.js" data-modules="core slider"></script> <script src="../../lib/bootstrap.js" data-widget="slider"></script> </head> diff --git a/tests/unit/sortable/sortable.html b/tests/unit/sortable/sortable.html index a4c94ba0d..8bfbd3370 100644 --- a/tests/unit/sortable/sortable.html +++ b/tests/unit/sortable/sortable.html @@ -4,6 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Sortable Test Suite</title> + <script src="../../../external/requirejs/require.js"></script> <script src="../../lib/css.js" data-modules="core"></script> <script src="../../lib/bootstrap.js" data-widget="sortable"></script> <style> diff --git a/tests/unit/spinner/spinner.html b/tests/unit/spinner/spinner.html index 43ded34a7..ff38f16a8 100644 --- a/tests/unit/spinner/spinner.html +++ b/tests/unit/spinner/spinner.html @@ -4,6 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Spinner Test Suite</title> + <script src="../../../external/requirejs/require.js"></script> <script src="../../lib/css.js" data-modules="core button spinner"></script> <script src="../../lib/bootstrap.js" data-widget="spinner"></script> </head> diff --git a/tests/unit/tabs/tabs.html b/tests/unit/tabs/tabs.html index 6d52a2490..cb4e5389f 100644 --- a/tests/unit/tabs/tabs.html +++ b/tests/unit/tabs/tabs.html @@ -4,6 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Tabs Test Suite</title> + <script src="../../../external/requirejs/require.js"></script> <script src="../../lib/css.js" data-modules="core tabs"></script> <script src="../../lib/bootstrap.js" data-widget="tabs"></script> <style> diff --git a/tests/unit/tooltip/deprecated.html b/tests/unit/tooltip/deprecated.html index d21fea57b..f2d04f3d1 100644 --- a/tests/unit/tooltip/deprecated.html +++ b/tests/unit/tooltip/deprecated.html @@ -4,6 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Tooltip Test Suite</title> + <script src="../../../external/requirejs/require.js"></script> <script src="../../lib/css.js" data-modules="core tooltip"></script> <script src="../../lib/bootstrap.js" data-widget="tooltip" data-deprecated="true"></script> </head> diff --git a/tests/unit/tooltip/tooltip.html b/tests/unit/tooltip/tooltip.html index 1f0adc9f4..b5561d926 100644 --- a/tests/unit/tooltip/tooltip.html +++ b/tests/unit/tooltip/tooltip.html @@ -4,6 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Tooltip Test Suite</title> + <script src="../../../external/requirejs/require.js"></script> <script src="../../lib/css.js" data-modules="core tooltip"></script> <script src="../../lib/bootstrap.js" data-widget="tooltip" data-no-back-compat="true"></script> </head> diff --git a/tests/unit/widget/widget.html b/tests/unit/widget/widget.html index 0e9d50051..3dea2ed69 100644 --- a/tests/unit/widget/widget.html +++ b/tests/unit/widget/widget.html @@ -4,6 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Widget Test Suite</title> + <script src="../../../external/requirejs/require.js"></script> <script src="../../lib/css.js" data-modules="core"></script> <script src="../../lib/bootstrap.js" data-modules="core extend animation classes"> </script> |