+ 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("type", function() {
+ expect(18);
+
+ equals( jQuery.type(null), "null", "null" );
+ equals( jQuery.type(undefined), "undefined", "undefined" );
+ equals( jQuery.type(true), "boolean", "Boolean" );
+ equals( jQuery.type(false), "boolean", "Boolean" );
+ equals( jQuery.type(Boolean(true)), "boolean", "Boolean" );
+ equals( jQuery.type(0), "number", "Number" );
+ equals( jQuery.type(1), "number", "Number" );
+ equals( jQuery.type(Number(1)), "number", "Number" );
+ equals( jQuery.type(""), "string", "String" );
+ equals( jQuery.type("a"), "string", "String" );
+ equals( jQuery.type(String("a")), "string", "String" );
+ equals( jQuery.type({}), "object", "Object" );
+ equals( jQuery.type(/foo/), "regexp", "RegExp" );
+ equals( jQuery.type(new RegExp("asdf")), "regexp", "RegExp" );
+ equals( jQuery.type([1]), "array", "Array" );
+ equals( jQuery.type(new Date()), "date", "Date" );
+ equals( jQuery.type(new Function("return;")), "function", "Function" );
+ equals( jQuery.type(function(){}), "function", "Function" );
+});
+
+test("isPlainObject", function() {
+ expect(14);
+
+ stop();
+
+ // The use case that we want to match
+ ok(jQuery.isPlainObject({}), "{}");
+
+ // Not objects shouldn't be matched
+ ok(!jQuery.isPlainObject(""), "string");
+ ok(!jQuery.isPlainObject(0) && !jQuery.isPlainObject(1), "number");
+ ok(!jQuery.isPlainObject(true) && !jQuery.isPlainObject(false), "boolean");
+ ok(!jQuery.isPlainObject(null), "null");
+ ok(!jQuery.isPlainObject(undefined), "undefined");
+
+ // Arrays shouldn't be matched
+ ok(!jQuery.isPlainObject([]), "array");
+
+ // Instantiated objects shouldn't be matched
+ ok(!jQuery.isPlainObject(new Date), "new Date");
+
+ var fn = function(){};
+
+ // Functions shouldn't be matched
+ ok(!jQuery.isPlainObject(fn), "fn");
+
+ // Again, instantiated objects shouldn't be matched
+ ok(!jQuery.isPlainObject(new fn), "new fn (no methods)");
+
+ // Makes the function a little more realistic
+ // (and harder to detect, incidentally)
+ fn.prototype = {someMethod: function(){}};
+
+ // Again, instantiated objects shouldn't be matched
+ ok(!jQuery.isPlainObject(new fn), "new fn");
+
+ // DOM Element
+ ok(!jQuery.isPlainObject(document.createElement("div")), "DOM Element");
+
+ // Window
+ ok(!jQuery.isPlainObject(window), "window");
+
+ try {
+ var iframe = document.createElement("iframe");
+ document.body.appendChild(iframe);
+
+ window.iframeDone = function(otherObject){
+ // Objects from other windows should be matched
+ ok(jQuery.isPlainObject(new otherObject), "new otherObject");
+ document.body.removeChild( iframe );
+ start();
+ };
+
+ var doc = iframe.contentDocument || iframe.contentWindow.document;
+ doc.open();
+ doc.write("<body onload='window.parent.iframeDone(Object);'>");
+ doc.close();
+ } catch(e) {
+ document.body.removeChild( iframe );
+
+ ok(true, "new otherObject - iframes not supported");
+ start();
+ }