X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=test%2Funit%2Fcore.js;h=eccf544bf05f3cd8373f389c0a0c8a537772a1cc;hb=141ad3c3e21e7734e67e37b5fb39782fe11b3c18;hp=d8aba16db0d856efb8a39950fac358161000f976;hpb=0a307b332e896b6b480952abb5d3bf03819893c8;p=jquery.git diff --git a/test/unit/core.js b/test/unit/core.js index d8aba16..eccf544 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -201,14 +201,20 @@ test("noConflict", function() { }); test("trim", function() { - expect(4); + expect(9); - var nbsp = String.fromCharCode(160); + var nbsp = String.fromCharCode(160); - equals( jQuery.trim("hello "), "hello", "trailing space" ); - equals( jQuery.trim(" hello"), "hello", "leading space" ); - equals( jQuery.trim(" hello "), "hello", "space on both sides" ); - equals( jQuery.trim(" " + nbsp + "hello " + nbsp + " "), "hello", " " ); + equals( jQuery.trim("hello "), "hello", "trailing space" ); + equals( jQuery.trim(" hello"), "hello", "leading space" ); + equals( jQuery.trim(" hello "), "hello", "space on both sides" ); + equals( jQuery.trim(" " + nbsp + "hello " + nbsp + " "), "hello", " " ); + + equals( jQuery.trim(), "", "Nothing in." ); + equals( jQuery.trim( undefined ), "", "Undefined" ); + equals( jQuery.trim( null ), "", "Null" ); + equals( jQuery.trim( 5 ), "5", "Number" ); + equals( jQuery.trim( false ), "false", "Boolean" ); }); test("isPlainObject", function() {