]> source.dussan.org Git - jquery.git/commitdiff
Tests: Improve jsonp tests
authorOleg Gaidarenko <markelog@gmail.com>
Tue, 18 Feb 2014 17:50:42 +0000 (21:50 +0400)
committerOleg Gaidarenko <markelog@gmail.com>
Tue, 15 Apr 2014 13:46:25 +0000 (17:46 +0400)
Since global variable for callback always would be equal to undefined value
it better to check for boolean instead

test/data/testrunner.js
test/unit/ajax.js

index 1bebb13638fec85ecfe3d50a0e9a346c161929be..b97f3453ba6462bbe1c61967043b0ed4b26b9548 100644 (file)
@@ -196,7 +196,7 @@ window.Globals = (function() {
        return {
                register: function( name ) {
                        globals[ name ] = true;
-                       supportjQuery.globalEval( "var " + name + " = undefined;" );
+                       supportjQuery.globalEval( "var " + name + " = true;" );
                },
                cleanup: function() {
                        var name,
index 2f4bc04e5bf91e2ef2c7c3781c724f1ebab53cd7..3a2ac11c43a20851e1f9db46065c95929b46245e 100644 (file)
@@ -728,7 +728,7 @@ module( "ajax", {
                                jsonpCallback: "functionToCleanUp",
                                success: function( data ) {
                                        ok( data["data"], "JSON results returned (GET, custom callback name to be cleaned up)" );
-                                       strictEqual( window["functionToCleanUp"], undefined, "Callback was removed (GET, custom callback name to be cleaned up)" );
+                                       strictEqual( window["functionToCleanUp"], true, "Callback was removed (GET, custom callback name to be cleaned up)" );
                                        var xhr;
                                        jQuery.ajax({
                                                url: "data/jsonp.php",
@@ -742,7 +742,7 @@ module( "ajax", {
                                        });
                                        xhr.fail(function() {
                                                ok( true, "Ajax error JSON (GET, custom callback name to be cleaned up)" );
-                                               strictEqual( window["functionToCleanUp"], undefined, "Callback was removed after early abort (GET, custom callback name to be cleaned up)" );
+                                               strictEqual( window["functionToCleanUp"], true, "Callback was removed after early abort (GET, custom callback name to be cleaned up)" );
                                        });
                                }
                        }, {