Fixes $.trim for   closes #4980
[jquery.git] / test / unit / core.js
index 4044bd8..0640cf5 100644 (file)
@@ -189,6 +189,17 @@ test("noConflict", function() {
        jQuery = $$;
 });
 
+test("trim", function() {
+  expect(4);
+
+  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", " " );
+});
+
 test("isFunction", function() {
        expect(19);