+ equals( div.parent().length, 0, "Make sure that the generated HTML has no parent." );
+
+ equals( jQuery([1,2,3]).get(1), 2, "Test passing an array to the factory" );
+
+ equals( jQuery(document.body).get(0), jQuery('body').get(0), "Test passing an html node to the factory" );
+
+ var exec = false;
+
+ var elem = jQuery("<div/>", {
+ width: 10,
+ css: { paddingLeft:1, paddingRight:1 },
+ click: function(){ ok(exec, "Click executed."); },
+ text: "test",
+ "class": "test2",
+ id: "test3"
+ });
+
+ equals( elem[0].style.width, '10px', 'jQuery() quick setter width');
+ equals( elem[0].style.paddingLeft, '1px', 'jQuery quick setter css');
+ equals( elem[0].style.paddingRight, '1px', 'jQuery quick setter css');
+ equals( elem[0].childNodes.length, 1, 'jQuery quick setter text');
+ equals( elem[0].firstChild.nodeValue, "test", 'jQuery quick setter text');
+ equals( elem[0].className, "test2", 'jQuery() quick setter class');
+ equals( elem[0].id, "test3", 'jQuery() quick setter id');
+
+ exec = true;
+ elem.click();
+});
+
+test("selector state", function() {
+ expect(31);
+
+ var test;
+
+ test = jQuery(undefined);
+ equals( test.selector, "", "Empty jQuery Selector" );
+ equals( test.context, undefined, "Empty jQuery Context" );
+
+ test = jQuery(document);
+ equals( test.selector, "", "Document Selector" );
+ equals( test.context, document, "Document Context" );
+
+ test = jQuery(document.body);
+ equals( test.selector, "", "Body Selector" );
+ equals( test.context, document.body, "Body Context" );
+
+ test = jQuery("#main");
+ equals( test.selector, "#main", "#main Selector" );
+ equals( test.context, document, "#main Context" );
+
+ test = jQuery("#notfoundnono");
+ equals( test.selector, "#notfoundnono", "#notfoundnono Selector" );
+ equals( test.context, document, "#notfoundnono Context" );
+
+ test = jQuery("#main", document);
+ equals( test.selector, "#main", "#main Selector" );
+ equals( test.context, document, "#main Context" );
+
+ test = jQuery("#main", document.body);
+ equals( test.selector, "#main", "#main Selector" );
+ equals( test.context, document.body, "#main Context" );
+
+ // Test cloning
+ test = jQuery(test);
+ equals( test.selector, "#main", "#main Selector" );
+ equals( test.context, document.body, "#main Context" );
+
+ test = jQuery(document.body).find("#main");
+ equals( test.selector, "#main", "#main find Selector" );
+ equals( test.context, document.body, "#main find Context" );
+
+ test = jQuery("#main").filter("div");
+ equals( test.selector, "#main.filter(div)", "#main filter Selector" );
+ equals( test.context, document, "#main filter Context" );
+
+ test = jQuery("#main").not("div");
+ equals( test.selector, "#main.not(div)", "#main not Selector" );
+ equals( test.context, document, "#main not Context" );
+
+ test = jQuery("#main").filter("div").not("div");
+ equals( test.selector, "#main.filter(div).not(div)", "#main filter, not Selector" );
+ equals( test.context, document, "#main filter, not Context" );
+
+ test = jQuery("#main").filter("div").not("div").end();
+ equals( test.selector, "#main.filter(div)", "#main filter, not, end Selector" );
+ equals( test.context, document, "#main filter, not, end Context" );
+
+ test = jQuery("#main").parent("body");
+ equals( test.selector, "#main.parent(body)", "#main parent Selector" );
+ equals( test.context, document, "#main parent Context" );
+
+ test = jQuery("#main").eq(0);
+ equals( test.selector, "#main.slice(0,1)", "#main eq Selector" );
+ equals( test.context, document, "#main eq Context" );
+
+ var d = "<div />";
+ equals(
+ jQuery(d).appendTo(jQuery(d)).selector,
+ jQuery(d).appendTo(d).selector,
+ "manipulation methods make same selector for jQuery objects"
+ );
+});
+
+if ( !isLocal ) {
+test("browser", function() {
+ stop();
+
+ jQuery.get("data/ua.txt", function(data){
+ var uas = data.split("\n");
+ expect( (uas.length - 1) * 2 );
+
+ jQuery.each(uas, function(){
+ var parts = this.split("\t");
+ if ( parts[2] ) {
+ var ua = jQuery.uaMatch( parts[2] );
+ equals( ua.browser, parts[0], "Checking browser for " + parts[2] );
+ equals( ua.version, parts[1], "Checking version string for " + parts[2] );
+ }
+ });
+
+ start();
+ });
+});
+}
+
+test("noConflict", function() {
+ expect(7);
+
+ var $$ = jQuery;
+
+ equals( jQuery, jQuery.noConflict(), "noConflict returned the jQuery object" );
+ equals( jQuery, $$, "Make sure jQuery wasn't touched." );
+ equals( $, original$, "Make sure $ was reverted." );
+
+ jQuery = $ = $$;
+
+ equals( jQuery.noConflict(true), $$, "noConflict returned the jQuery object" );
+ equals( jQuery, originaljQuery, "Make sure jQuery was reverted." );
+ equals( $, original$, "Make sure $ was reverted." );
+ ok( $$("#main").html("test"), "Make sure that jQuery still works." );
+
+ jQuery = $$;
+});
+
+test("trim", function() {
+ expect(9);
+
+ 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(), "", "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(23);
+
+ 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" );
+ equals( jQuery.type(window), "object", "Window" );
+ equals( jQuery.type(document), "object", "Document" );
+ equals( jQuery.type(document.body), "object", "Element" );
+ equals( jQuery.type(document.createTextNode("foo")), "object", "TextNode" );
+ equals( jQuery.type(document.getElementsByTagName("*")), "object", "NodeList" );
+});
+
+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();
+ }