Skip to content

Commit 0714f55

Browse files
committed
Tests: Support $.uiBackCompat = false via data-no-back-compat
Ref #10119 Ref gh-1528
1 parent 7d168ce commit 0714f55

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

tests/lib/bootstrap.js

+14-4
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ function requireModules( dependencies, callback, modules ) {
4141
}
4242

4343
// Load a set of test file along with the required test infrastructure
44-
function requireTests( dependencies, callback ) {
44+
function requireTests( dependencies, noBackCompat ) {
4545
dependencies = [
4646
"../../lib/qunit",
47-
"jquery",
47+
noBackCompat ? "jquery-no-back-compat" : "jquery",
4848
"jquery-simulate",
4949
"qunit-assert-classes",
5050
"../../lib/qunit-assert-domequal"
@@ -101,6 +101,7 @@ function swarmInject() {
101101
// - data-widget: A widget to load test modules for
102102
// - Automatically loads common, core, events, methods, and options
103103
// - data-deprecated: Loads the deprecated test modules for a widget
104+
// - data-no-back-compat: Set $.uiBackCompat to false
104105
(function() {
105106

106107
// Find the script element
@@ -117,7 +118,9 @@ function swarmInject() {
117118
modules = [];
118119
}
119120
var widget = script.getAttribute( "data-widget" );
120-
var deprecated = script.getAttribute( "data-deprecated" );
121+
var deprecated = !!script.getAttribute( "data-deprecated" );
122+
var noBackCompat = !!script.getAttribute( "data-no-back-compat" );
123+
121124
if ( widget ) {
122125
modules = modules.concat([
123126
widget + ( deprecated ? "_common_deprecated" : "_common" ),
@@ -136,12 +139,19 @@ function swarmInject() {
136139
script.src = "../../../external/requirejs/require.js";
137140
script.onload = function() {
138141

142+
// Create a module that disables back compat for UI modules
143+
define( "jquery-no-back-compat", [ "jquery" ], function( $ ) {
144+
$.uiBackCompat = false;
145+
146+
return $;
147+
} );
148+
139149
// Create a dummy bridge if we're not actually testing in PhantomJS
140150
if ( !/PhantomJS/.test( navigator.userAgent ) ) {
141151
define( "phantom-bridge", function() {} );
142152
}
143153

144-
requireTests( modules );
154+
requireTests( modules, noBackCompat );
145155
};
146156
document.documentElement.appendChild( script );
147157
} )();

0 commit comments

Comments
 (0)