]> source.dussan.org Git - jquery.git/commitdiff
Tests: Fix failing ajax tests in oldIE
authorOleg Gaidarenko <markelog@gmail.com>
Fri, 4 Apr 2014 18:31:38 +0000 (22:31 +0400)
committerOleg Gaidarenko <markelog@gmail.com>
Tue, 15 Apr 2014 13:46:00 +0000 (17:46 +0400)
(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
test/data/test.js [deleted file]
test/data/test.php
test/data/testbar.php [new file with mode: 0644]
test/unit/ajax.js
test/unit/manipulation.js

index eec028e90f92b824b095f8cd824fe474b420c300..f5bc2199fc3cd564226a35f6115adb052d790202 100644 (file)
@@ -3,5 +3,5 @@ html text<br/>
 testFoo = "foo"; jQuery('#foo').html('foo');
 ok( true, "test.html executed" );
 /* ]]> */</script>
-<script src="data/test.js"></script>
+<script src="data/testbar.php"></script>
 blabla
diff --git a/test/data/test.js b/test/data/test.js
deleted file mode 100644 (file)
index fb33952..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-this.testBar = "bar";
-jQuery("#ap").html("bar");
-ok( true, "test.js executed");
index 3d08f3253ad3fbd381862165ed63998d45e801dd..d93dafad823578aeb284f03a4b044a87cf32f52b 100644 (file)
@@ -3,5 +3,5 @@ html text<br/>
 testFoo = "foo"; jQuery('#foo').html('foo');
 ok( true, "test.php executed" );
 /* ]]> */</script>
-<script src="data/test.js?<?php srand(); echo time() . '' . rand(); ?>"></script>
-blabla
\ No newline at end of file
+<script src="data/testbar.php?<?php srand(); echo time() . '' . rand(); ?>"></script>
+blabla
diff --git a/test/data/testbar.php b/test/data/testbar.php
new file mode 100644 (file)
index 0000000..21aa688
--- /dev/null
@@ -0,0 +1,3 @@
+this.testBar = "bar";
+jQuery("#ap").html("bar");
+ok( true, "testbar.php executed");
index fcdfcb0f5f362e452a7d1cc7b9be8b63839b273b..25397e85ec0992868d09a58ddf80475032ed4eae 100644 (file)
@@ -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
index 5349cb3fcf5134b24c553e8efb14ba59b6abbb98..ac99654b9e7203cf96d1968a4a54cf29accfdb9e 100644 (file)
@@ -2284,7 +2284,7 @@ test( "script evaluation (#11795)", function() {
 
        if ( jQuery.ajax ) {
                Globals.register("testBar");
-               jQuery("#qunit-fixture").append( "<script src='" + url("data/test.js") + "'/>" );
+               jQuery("#qunit-fixture").append( "<script src='" + url("data/testbar.php") + "'/>" );
                strictEqual( window["testBar"], "bar", "Global script evaluation" );
        } else {
                ok( true, "No jQuery.ajax" );