Commit 3144163f authored by Dave Methvin's avatar Dave Methvin

Followup for #12751, only test on browsers with JSON.parse

parent c6cf30a5
...@@ -1351,7 +1351,9 @@ test("jQuery.camelCase()", function() { ...@@ -1351,7 +1351,9 @@ test("jQuery.camelCase()", function() {
}); });
}); });
test( "JQuery.parseJSON() test internal parseJson (using fallback) to make sure that it throws like JSON.parse", function() { // Ensure our window.JSON matches behavior of the native one, if it exists
if ( window.JSON ) {
test( "JQuery.parseJSON() equivalence to JSON.parse", function() {
expect( 10 ); expect( 10 );
var jsonParse = window.JSON; var jsonParse = window.JSON;
...@@ -1382,10 +1384,10 @@ test( "JQuery.parseJSON() test internal parseJson (using fallback) to make sure ...@@ -1382,10 +1384,10 @@ test( "JQuery.parseJSON() test internal parseJson (using fallback) to make sure
}); });
var parsedValue = jsonParse.parse(null); var parsedValue = jsonParse.parse(null);
equal( parsedValue, null ); equal( parsedValue, null, "parsed null" );
parsedValue = jQuery.parseJSON(null); parsedValue = jQuery.parseJSON(null);
equal( parsedValue, null ); equal( parsedValue, null, "parsed null" );
parsedValue = jsonParse.parse("{}"); parsedValue = jsonParse.parse("{}");
equal( (typeof parsedValue === "object"), true ); equal( (typeof parsedValue === "object"), true );
...@@ -1395,5 +1397,6 @@ test( "JQuery.parseJSON() test internal parseJson (using fallback) to make sure ...@@ -1395,5 +1397,6 @@ test( "JQuery.parseJSON() test internal parseJson (using fallback) to make sure
window.JSON = jsonParse; window.JSON = jsonParse;
} ); });
}
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