From 6231b161b92d28bdb6657cdd1f7d11436e6b132d Mon Sep 17 00:00:00 2001 From: Scott González Date: Fri, 17 Apr 2015 12:13:38 -0400 Subject: 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. --- Gruntfile.js | 3 ++- tests/.jshintrc | 3 ++- tests/lib/bootstrap.js | 39 +++++++++++++------------------ tests/unit/accordion/accordion.html | 1 + tests/unit/autocomplete/autocomplete.html | 1 + tests/unit/button/button.html | 1 + tests/unit/core/core.html | 1 + tests/unit/datepicker/datepicker.html | 1 + tests/unit/dialog/deprecated.html | 1 + tests/unit/dialog/dialog.html | 1 + tests/unit/draggable/draggable.html | 1 + tests/unit/droppable/deprecated.html | 1 + tests/unit/droppable/droppable.html | 1 + tests/unit/effects/effects.html | 1 + tests/unit/menu/menu.html | 1 + tests/unit/position/position.html | 1 + tests/unit/progressbar/progressbar.html | 1 + tests/unit/resizable/resizable.html | 1 + tests/unit/selectable/selectable.html | 1 + tests/unit/selectmenu/selectmenu.html | 1 + tests/unit/slider/slider.html | 1 + tests/unit/sortable/sortable.html | 1 + tests/unit/spinner/spinner.html | 1 + tests/unit/tabs/tabs.html | 1 + tests/unit/tooltip/deprecated.html | 1 + tests/unit/tooltip/tooltip.html | 1 + tests/unit/widget/widget.html | 1 + 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 @@ jQuery UI Accordion Test Suite +