diff options
author | Timo Tijhof <krinklemail@gmail.com> | 2015-01-07 20:12:49 +0000 |
---|---|---|
committer | Timmy Willison <timmywillisn@gmail.com> | 2015-01-19 11:38:04 -0500 |
commit | 4116914dcac32868c2c822366785e3dd2ccc69d4 (patch) | |
tree | 075e73ab652e466d9961b4a45cac3872aa04c08c /test/unit/core.js | |
parent | d7e5fcee519e5f3e840beef9e67a536e75133df9 (diff) | |
download | jquery-4116914dcac32868c2c822366785e3dd2ccc69d4.tar.gz jquery-4116914dcac32868c2c822366785e3dd2ccc69d4.zip |
Core: Return empty array instead of null for parseHTML("")
Fixes gh-1997
Close gh-1998
Diffstat (limited to 'test/unit/core.js')
-rw-r--r-- | test/unit/core.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/test/unit/core.js b/test/unit/core.js index eb05130c5..9bcd08fff 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -1301,13 +1301,18 @@ test("jQuery.proxy", function(){ }); test("jQuery.parseHTML", function() { - expect( 18 ); + expect( 23 ); var html, nodes; - equal( jQuery.parseHTML(), null, "Nothing in, null out." ); - equal( jQuery.parseHTML( null ), null, "Null in, null out." ); - equal( jQuery.parseHTML( "" ), null, "Empty string in, null out." ); + deepEqual( jQuery.parseHTML(), [], "Without arguments" ); + deepEqual( jQuery.parseHTML( undefined ), [], "Undefined" ); + deepEqual( jQuery.parseHTML( null ), [], "Null" ); + deepEqual( jQuery.parseHTML( false ), [], "Boolean false" ); + deepEqual( jQuery.parseHTML( 0 ), [], "Zero" ); + deepEqual( jQuery.parseHTML( true ), [], "Boolean true" ); + deepEqual( jQuery.parseHTML( 42 ), [], "Positive number" ); + deepEqual( jQuery.parseHTML( "" ), [], "Empty string" ); throws(function() { jQuery.parseHTML( "<div></div>", document.getElementById("form") ); }, "Passing an element as the context raises an exception (context should be a document)"); |