Commit 1c041789 authored by Oleg Gaidarenko's avatar Oleg Gaidarenko

Tests: Improve jsonp tests

Since global variable for callback always would be equal to undefined value
it better to check for boolean instead
parent 9cdaa75b
...@@ -196,7 +196,7 @@ window.Globals = (function() { ...@@ -196,7 +196,7 @@ window.Globals = (function() {
return { return {
register: function( name ) { register: function( name ) {
globals[ name ] = true; globals[ name ] = true;
supportjQuery.globalEval( "var " + name + " = undefined;" ); supportjQuery.globalEval( "var " + name + " = true;" );
}, },
cleanup: function() { cleanup: function() {
var name, var name,
......
...@@ -728,7 +728,7 @@ module( "ajax", { ...@@ -728,7 +728,7 @@ module( "ajax", {
jsonpCallback: "functionToCleanUp", jsonpCallback: "functionToCleanUp",
success: function( data ) { success: function( data ) {
ok( data["data"], "JSON results returned (GET, custom callback name to be cleaned up)" ); 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; var xhr;
jQuery.ajax({ jQuery.ajax({
url: "data/jsonp.php", url: "data/jsonp.php",
...@@ -742,7 +742,7 @@ module( "ajax", { ...@@ -742,7 +742,7 @@ module( "ajax", {
}); });
xhr.fail(function() { xhr.fail(function() {
ok( true, "Ajax error JSON (GET, custom callback name to be cleaned up)" ); 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)" );
}); });
} }
}, { }, {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment