+
+ // can actually yield more than one, when iframes are included, the window is an array as well
+ equals( jQuery(window).length, 1, "Correct number of elements generated for window" );
+
+ equals( jQuery(document).length, 1, "Correct number of elements generated for document" );
+
+ 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" );
+});
+
+test("selector state", function() {
+ expect(26);
+
+ var test;
+
+ test = jQuery();
+ equals( test.selector, "", "Empty jQuery Selector" );
+ equals( test.context, document, "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("#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 = 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" );
+});
+
+test("browser", function() {
+ expect(13);
+ var browsers = {
+ //Internet Explorer
+ "Mozilla/5.0 (Windows; U; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)": "6.0",
+ "Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727)": "7.0",
+ /** Failing #1876
+ * "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.0.04506.30)": "7.0",
+ */
+ //Browsers with Gecko engine
+ //Mozilla
+ "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915" : "1.7.12",
+ //Firefox
+ "Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3": "1.8.1.3",
+ //Netscape
+ "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20070321 Netscape/8.1.3" : "1.7.5",
+ //Flock
+ "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.11) Gecko/20070321 Firefox/1.5.0.11 Flock/0.7.12" : "1.8.0.11",
+ //Opera browser
+ "Opera/9.20 (X11; Linux x86_64; U; en)": "9.20",
+ "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 9.20" : "9.20",
+ "Mozilla/5.0 (Windows NT 5.1; U; pl; rv:1.8.0) Gecko/20060728 Firefox/1.5.0 Opera 9.20": "9.20",
+ //WebKit engine
+ "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; sv-se) AppleWebKit/418.9 (KHTML, like Gecko) Safari/419.3": "418.9",
+ "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/418.8 (KHTML, like Gecko) Safari/419.3" : "418.8",
+ "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; sv-se) AppleWebKit/312.8 (KHTML, like Gecko) Safari/312.5": "312.8",
+ //Other user agent string
+ "Other browser's user agent 1.0":null
+ };
+ for (var i in browsers) {
+ var v = i.toLowerCase().match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ); // RegEx from Core jQuery.browser.version check
+ version = v ? v[1] : null;
+ equals( version, browsers[i], "Checking UA string" );
+ }