diff options
author | Timmy Willison <4timmywil@gmail.com> | 2016-08-15 11:41:11 -0400 |
---|---|---|
committer | Timmy Willison <4timmywil@gmail.com> | 2016-08-15 11:54:55 -0400 |
commit | 52e24471c89b80e6208b4987bb76994e64c1e489 (patch) | |
tree | 5914b1a5bec65c59f94f9780f45b35029d03641a /test | |
parent | 560c0c6f995a4f7584dac5be8fe5eea114a95f69 (diff) | |
download | jquery-52e24471c89b80e6208b4987bb76994e64c1e489.tar.gz jquery-52e24471c89b80e6208b4987bb76994e64c1e489.zip |
Core: expose noConflict in AMD mode
- For compability reasons, we had already added the global
in AMD mode, but without noConflict. This adds back noConflict
to AMD (which fixes noConflict mode in the tests).
Fixes gh-2930
Diffstat (limited to 'test')
-rw-r--r-- | test/data/testinit.js | 4 | ||||
-rw-r--r-- | test/unit/core.js | 29 |
2 files changed, 14 insertions, 19 deletions
diff --git a/test/data/testinit.js b/test/data/testinit.js index 9e2679654..ef210e739 100644 --- a/test/data/testinit.js +++ b/test/data/testinit.js @@ -320,9 +320,7 @@ this.loadTests = function() { /** * Run in noConflict mode */ - if ( jQuery.noConflict ) { - jQuery.noConflict(); - } + jQuery.noConflict(); // Load the TestSwarm listener if swarmURL is in the address. if ( QUnit.isSwarm ) { diff --git a/test/unit/core.js b/test/unit/core.js index b00db8c33..f5083b4a9 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -197,27 +197,24 @@ QUnit.test( "globalEval execution after script injection (#7862)", function( ass assert.ok( window.strictEvalTest - now < 500, "Code executed synchronously" ); } ); -// This is not run in AMD mode -if ( jQuery.noConflict ) { - QUnit.test( "noConflict", function( assert ) { - assert.expect( 7 ); +QUnit.test( "noConflict", function( assert ) { + assert.expect( 7 ); - var $$ = jQuery; + var $$ = jQuery; - assert.strictEqual( jQuery, jQuery.noConflict(), "noConflict returned the jQuery object" ); - assert.strictEqual( window[ "jQuery" ], $$, "Make sure jQuery wasn't touched." ); - assert.strictEqual( window[ "$" ], original$, "Make sure $ was reverted." ); + assert.strictEqual( jQuery, jQuery.noConflict(), "noConflict returned the jQuery object" ); + assert.strictEqual( window[ "jQuery" ], $$, "Make sure jQuery wasn't touched." ); + assert.strictEqual( window[ "$" ], original$, "Make sure $ was reverted." ); - jQuery = $ = $$; + jQuery = $ = $$; - assert.strictEqual( jQuery.noConflict( true ), $$, "noConflict returned the jQuery object" ); - assert.strictEqual( window[ "jQuery" ], originaljQuery, "Make sure jQuery was reverted." ); - assert.strictEqual( window[ "$" ], original$, "Make sure $ was reverted." ); - assert.ok( $$().pushStack( [] ), "Make sure that jQuery still works." ); + assert.strictEqual( jQuery.noConflict( true ), $$, "noConflict returned the jQuery object" ); + assert.strictEqual( window[ "jQuery" ], originaljQuery, "Make sure jQuery was reverted." ); + assert.strictEqual( window[ "$" ], original$, "Make sure $ was reverted." ); + assert.ok( $$().pushStack( [] ), "Make sure that jQuery still works." ); - window[ "jQuery" ] = jQuery = $$; - } ); -} + window[ "jQuery" ] = jQuery = $$; +} ); QUnit.test( "trim", function( assert ) { assert.expect( 13 ); |