diff options
author | Scott González <scott.gonzalez@gmail.com> | 2015-04-06 20:22:54 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2015-04-09 09:26:27 -0400 |
commit | 0714f55ad48c9d3dace29003677353f5e152a13a (patch) | |
tree | 83f1afbb055d6c2df7f7573f702d0a5d9d953a2a /tests/lib | |
parent | 7d168ce6300a4b59f54c7b7f55c622a7a60ba222 (diff) | |
download | jquery-ui-0714f55ad48c9d3dace29003677353f5e152a13a.tar.gz jquery-ui-0714f55ad48c9d3dace29003677353f5e152a13a.zip |
Tests: Support `$.uiBackCompat = false` via `data-no-back-compat`
Ref #10119
Ref gh-1528
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/bootstrap.js | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/lib/bootstrap.js b/tests/lib/bootstrap.js index 94954ba39..b9598c6df 100644 --- a/tests/lib/bootstrap.js +++ b/tests/lib/bootstrap.js @@ -41,10 +41,10 @@ function requireModules( dependencies, callback, modules ) { } // Load a set of test file along with the required test infrastructure -function requireTests( dependencies, callback ) { +function requireTests( dependencies, noBackCompat ) { dependencies = [ "../../lib/qunit", - "jquery", + noBackCompat ? "jquery-no-back-compat" : "jquery", "jquery-simulate", "qunit-assert-classes", "../../lib/qunit-assert-domequal" @@ -101,6 +101,7 @@ function swarmInject() { // - data-widget: A widget to load test modules for // - Automatically loads common, core, events, methods, and options // - data-deprecated: Loads the deprecated test modules for a widget +// - data-no-back-compat: Set $.uiBackCompat to false (function() { // Find the script element @@ -117,7 +118,9 @@ function swarmInject() { modules = []; } var widget = script.getAttribute( "data-widget" ); - var deprecated = script.getAttribute( "data-deprecated" ); + var deprecated = !!script.getAttribute( "data-deprecated" ); + var noBackCompat = !!script.getAttribute( "data-no-back-compat" ); + if ( widget ) { modules = modules.concat([ widget + ( deprecated ? "_common_deprecated" : "_common" ), @@ -136,12 +139,19 @@ function swarmInject() { 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 ); + requireTests( modules, noBackCompat ); }; document.documentElement.appendChild( script ); } )(); |