X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=test%2Funit%2Fcore.js;h=289a8bace0f9318d874607bd22bd813703d9c8ec;hb=e73990a566fcb2dac71e1a25ec83382645adc5b7;hp=9a1cecbe4225d644a6031b6958ea1e6d49d352c1;hpb=d20e7fede1ea2e7047a34a1749bc127c22b02049;p=jquery.git diff --git a/test/unit/core.js b/test/unit/core.js index 9a1cecb..289a8ba 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -53,7 +53,7 @@ test("jQuery()", function() { }); test("selector state", function() { - expect(26); + expect(30); var test; @@ -72,6 +72,10 @@ test("selector state", function() { 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" ); @@ -80,6 +84,11 @@ test("selector state", function() { 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" ); @@ -141,7 +150,7 @@ test("browser", function() { }; 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; + var version = v ? v[1] : null; equals( version, browsers[i], "Checking UA string" ); } }); @@ -251,23 +260,23 @@ test("isFunction", function() { }); }); -var foo = false; - test("jQuery('html')", function() { - expect(6); + expect(8); reset(); - foo = false; - var s = jQuery("")[0]; + jQuery.foo = false; + var s = jQuery("")[0]; ok( s, "Creating a script" ); - ok( !foo, "Make sure the script wasn't executed prematurely" ); - jQuery("body").append(""); - ok( foo, "Executing a scripts contents in the right context" ); + ok( !jQuery.foo, "Make sure the script wasn't executed prematurely" ); + jQuery("body").append(""); + ok( jQuery.foo, "Executing a scripts contents in the right context" ); reset(); ok( jQuery("")[0], "Creating a link" ); - reset(); + ok( !jQuery("
'); + stop(); jQuery("#main").html(''); @@ -1320,7 +1448,7 @@ test("html(String)", function() { jQuery("#main").html('foo
'); // it was decided that waiting to execute ALL scripts makes sense since nested ones have to wait anyway so this test case is changed, see #1959 - jQuery("#main").html("