From c3498187421d0a50ee0369163428481137a04b99 Mon Sep 17 00:00:00 2001 From: abnud1 Date: Mon, 18 Feb 2019 19:02:38 +0100 Subject: Build: Update test code for compatibility with QUnit 2.x (#4297) Also, run `grunt npmcopy` to sync the "external" directory with dependencies from package.json. For example, the Sinon library version didn't match. Ref gh-4234 Closes gh-4297 --- test/unit/manipulation.js | 77 +++++++++++++++++++++++++---------------------- 1 file changed, 41 insertions(+), 36 deletions(-) (limited to 'test/unit/manipulation.js') diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index 0acb45f3e..d72f1374f 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -1,5 +1,5 @@ QUnit.module( "manipulation", { - teardown: moduleTeardown + afterEach: moduleTeardown } ); // Ensure that an extended Array prototype doesn't break jQuery @@ -1300,7 +1300,7 @@ function testReplaceWith( val, assert ) { $div = jQuery( "
" ).appendTo( "#qunit-fixture" ); $div.replaceWith( val( "
" ) ); jQuery( "#qunit-fixture" ).append( "
" ); @@ -1754,15 +1754,15 @@ function testHtml( valueObj, assert ) { tmp = fixture.html( valueObj( [ - "", - "", - "", - "", + "", + "", + "", + "", "
", - "", - "", - "", - "", + "", + "", + "", + "", "
" ].join( "" ) ) ).find( "script" ); @@ -1770,19 +1770,19 @@ function testHtml( valueObj, assert ) { assert.equal( tmp[ 0 ].type, "something/else", "Non-evaluated type." ); assert.equal( tmp[ 1 ].type, "text/javascript", "Evaluated type." ); - fixture.html( valueObj( "" ) ); - fixture.html( valueObj( "" ) ); - fixture.html( valueObj( "" ) ); - fixture.html( valueObj( "foo
" ) ); + fixture.html( valueObj( "" ) ); + fixture.html( valueObj( "" ) ); + fixture.html( valueObj( "" ) ); + fixture.html( valueObj( "foo
" ) ); jQuery.scriptorder = 0; fixture.html( valueObj( [ "", - "", - "" + "", + "" ].join( "" ) ) ); fixture.html( valueObj( fixture.text() ) ); @@ -1810,10 +1810,10 @@ QUnit[ $fixture.html( [ - "", + "", "", "
", - "", + "", "", "
" ].join( "" ) @@ -2273,7 +2273,7 @@ QUnit.test( "domManip executes scripts containing html comments or CDATA (trac-9 jQuery( [ "" ].join( "\n" ) ).appendTo( "#qunit-fixture" ); @@ -2281,7 +2281,7 @@ QUnit.test( "domManip executes scripts containing html comments or CDATA (trac-9 jQuery( [ "" ].join( "\n" ) ).appendTo( "#qunit-fixture" ); @@ -2289,7 +2289,7 @@ QUnit.test( "domManip executes scripts containing html comments or CDATA (trac-9 jQuery( [ "" ].join( "\n" ) ).appendTo( "#qunit-fixture" ); @@ -2418,13 +2418,15 @@ QUnit.test( "Ensure oldIE creates a new set on appendTo (#8894)", function( asse assert.strictEqual( jQuery( "

" ).appendTo( "

" ).end().length, jQuery( "

test

" ).appendTo( "
" ).end().length, "Elements created with createElement and with createDocumentFragment should be treated alike" ); } ); -QUnit.asyncTest( "html() - script exceptions bubble (#11743)", 2, function( assert ) { - var onerror = window.onerror; +QUnit.test( "html() - script exceptions bubble (#11743)", function( assert ) { + assert.expect( 2 ); + var done = assert.async(), + onerror = window.onerror; setTimeout( function() { window.onerror = onerror; - QUnit.start(); + done(); }, 1000 ); window.onerror = function() { @@ -2493,15 +2495,15 @@ QUnit.test( "script evaluation (#11795)", function( assert ) { objGlobal.ok = notOk; scriptsIn = jQuery( [ - "", - "", - "", - "", + "", + "", + "", + "", "
", - "", - "", - "", - "", + "", + "", + "", + "", "
" ].join( "" ) ); scriptsIn.appendTo( jQuery( "
" ) ); @@ -2823,7 +2825,8 @@ QUnit.test( "Make sure tags with single-character names are found (gh-4124)", fu assert.strictEqual( htmlOut, htmlIn ); } ); -QUnit.test( "Insert script with data-URI (gh-1887)", 1, function( assert ) { +QUnit.test( "Insert script with data-URI (gh-1887)", function( assert ) { + assert.expect( 1 ); Globals.register( "testFoo" ); Globals.register( "testSrcFoo" ); @@ -2849,7 +2852,9 @@ QUnit.test( "Insert script with data-URI (gh-1887)", 1, function( assert ) { }, 100 ); } ); -QUnit.test( "Ignore content from unsuccessful responses (gh-4126)", 1, function( assert ) { +QUnit.test( "Ignore content from unsuccessful responses (gh-4126)", function( assert ) { + assert.expect( 1 ); + var globalEval = jQuery.globalEval; jQuery.globalEval = function( code ) { assert.ok( false, "no attempt to evaluate code from an unsuccessful response" ); -- cgit v1.2.3