From f3b89ba0820882bd4ce4404b7e7c819e7b506de5 Mon Sep 17 00:00:00 2001 From: Oleg Gaidarenko Date: Fri, 4 Apr 2014 22:31:38 +0400 Subject: [PATCH] Tests: Fix failing ajax tests in oldIE (cherry-picked from the 71780965072b1271018f2cf360e82fbe31f4987e) Picked up so tests from the 1.x-master would be more similar to this branch --- test/data/test.html | 2 +- test/data/test.php | 4 ++-- test/data/{test.js => testbar.php} | 2 +- test/unit/ajax.js | 22 +++++++++++++--------- test/unit/manipulation.js | 2 +- 5 files changed, 18 insertions(+), 14 deletions(-) rename test/data/{test.js => testbar.php} (58%) diff --git a/test/data/test.html b/test/data/test.html index eec028e90..f5bc2199f 100644 --- a/test/data/test.html +++ b/test/data/test.html @@ -3,5 +3,5 @@ html text
testFoo = "foo"; jQuery('#foo').html('foo'); ok( true, "test.html executed" ); /* ]]> */ - + blabla diff --git a/test/data/test.php b/test/data/test.php index 3d08f3253..d93dafad8 100644 --- a/test/data/test.php +++ b/test/data/test.php @@ -3,5 +3,5 @@ html text
testFoo = "foo"; jQuery('#foo').html('foo'); ok( true, "test.php executed" ); /* ]]> */ - -blabla \ No newline at end of file + +blabla diff --git a/test/data/test.js b/test/data/testbar.php similarity index 58% rename from test/data/test.js rename to test/data/testbar.php index fb3395296..21aa6882b 100644 --- a/test/data/test.js +++ b/test/data/testbar.php @@ -1,3 +1,3 @@ this.testBar = "bar"; jQuery("#ap").html("bar"); -ok( true, "test.js executed"); +ok( true, "testbar.php executed"); diff --git a/test/unit/ajax.js b/test/unit/ajax.js index fcdfcb0f5..25397e85e 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -607,7 +607,7 @@ module( "ajax", { ok( jQuery.get( url(target), success ), "get" ); ok( jQuery.post( url(target), success ), "post" ); - ok( jQuery.getScript( url("data/test.js"), success ), "script" ); + ok( jQuery.getScript( url("data/testbar.php"), success ), "script" ); ok( jQuery.getJSON( url("data/json_obj.js"), success ), "json" ); ok( jQuery.ajax({ url: url( target ), @@ -855,7 +855,7 @@ module( "ajax", { setup: function() { Globals.register("testBar"); }, - url: window.location.href.replace( /[^\/]*$/, "" ) + "data/test.js", + url: window.location.href.replace( /[^\/]*$/, "" ) + "data/testbar.php", dataType: "script", success: function() { strictEqual( window["testBar"], "bar", "Script results returned (GET, no callback)" ); @@ -866,7 +866,7 @@ module( "ajax", { setup: function() { Globals.register("testBar"); }, - url: window.location.href.replace( /[^\/]*$/, "" ) + "data/test.js", + url: window.location.href.replace( /[^\/]*$/, "" ) + "data/testbar.php", type: "POST", dataType: "script", success: function( data, status ) { @@ -879,7 +879,7 @@ module( "ajax", { setup: function() { Globals.register("testBar"); }, - url: window.location.href.replace( /[^\/]*$/, "" ).replace( /^.*?\/\//, "//" ) + "data/test.js", + url: window.location.href.replace( /[^\/]*$/, "" ).replace( /^.*?\/\//, "//" ) + "data/testbar.php", dataType: "script", success: function() { strictEqual( window["testBar"], "bar", "Script results returned (GET, no callback)" ); @@ -1733,7 +1733,7 @@ module( "ajax", { asyncTest( "jQuery.getScript( String, Function ) - with callback", 2, function() { Globals.register("testBar"); - jQuery.getScript( url("data/test.js"), function() { + jQuery.getScript( url("data/testbar.php"), function() { strictEqual( window["testBar"], "bar", "Check if script was evaluated" ); start(); }); @@ -1741,12 +1741,12 @@ module( "ajax", { asyncTest( "jQuery.getScript( String, Function ) - no callback", 1, function() { Globals.register("testBar"); - jQuery.getScript( url("data/test.js") ).done( start ); + jQuery.getScript( url("data/testbar.php") ).done( start ); }); asyncTest( "#8082 - jQuery.getScript( String, Function ) - source as responseText", 2, function() { Globals.register("testBar"); - jQuery.getScript( url("data/test.js"), function( data, _, jqXHR ) { + jQuery.getScript( url("data/testbar.php"), function( data, _, jqXHR ) { strictEqual( data, jqXHR.responseText, "Same-domain script requests returns the source of the script" ); start(); }); @@ -1974,7 +1974,9 @@ module( "ajax", { strictEqual( data, "test%5Blength%5D=7&test%5Bfoo%5D=bar", "Check if a sub-object with a length param is serialized correctly" ); } }) - ).always( start ); + ).always(function() { + start(); + }); }); asyncTest( "jQuery.post( String, Hash, Function ) - simple with xml", 4, function() { @@ -1997,7 +1999,9 @@ module( "ajax", { strictEqual( jQuery( "result", this ).text(), "3", "Check for XML" ); }); }) - ).always( start ); + ).always(function() { + start(); + }); }); //----------- jQuery.active diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index 5349cb3fc..ac99654b9 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -2284,7 +2284,7 @@ test( "script evaluation (#11795)", function() { if ( jQuery.ajax ) { Globals.register("testBar"); - jQuery("#qunit-fixture").append( "