diff options
author | jeresig <jeresig@gmail.com> | 2010-02-13 02:14:23 -0500 |
---|---|---|
committer | jeresig <jeresig@gmail.com> | 2010-02-13 02:14:23 -0500 |
commit | 94d925cd4615d88532737f3cd106ecd1f8c34bc3 (patch) | |
tree | 29e9222ee871092f536286fa90e999a32f0e9da0 /test/unit/core.js | |
parent | 8b86004f9cf146f7e1e28c8ca98b893f9feac472 (diff) | |
download | jquery-94d925cd4615d88532737f3cd106ecd1f8c34bc3.tar.gz jquery-94d925cd4615d88532737f3cd106ecd1f8c34bc3.zip |
Make sure leading whitespace is trimmed for parseJSON. Fixes #6031.
Diffstat (limited to 'test/unit/core.js')
-rw-r--r-- | test/unit/core.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/test/unit/core.js b/test/unit/core.js index 4576ab8eb..d8aba16db 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -807,7 +807,7 @@ test("jQuery.proxy", function(){ }); test("jQuery.parseJSON", function(){ - expect(7); + expect(8); equals( jQuery.parseJSON(), null, "Nothing in, null out." ); equals( jQuery.parseJSON( null ), null, "Nothing in, null out." ); @@ -815,6 +815,8 @@ test("jQuery.parseJSON", function(){ same( jQuery.parseJSON("{}"), {}, "Plain object parsing." ); same( jQuery.parseJSON('{"test":1}'), {"test":1}, "Plain object parsing." ); + + same( jQuery.parseJSON('\n{"test":1}'), {"test":1}, "Make sure leading whitespaces are handled." ); try { jQuery.parseJSON("{a:1}"); @@ -829,4 +831,4 @@ test("jQuery.parseJSON", function(){ } catch( e ) { ok( true, "Test malformed JSON string." ); } -});
\ No newline at end of file +}); |