X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=test%2Funit%2Fcore.js;h=4d04af759a1509a61e1c499a50bb333e2758d11d;hb=1eae1541b8b4ca054d63d48f07001f55fa52fa5d;hp=98a161fa8ef8bf947c824b9bca97b8fe75a9b90d;hpb=c6f189ac73939c813bf3a2b848c492c8ba259807;p=jquery.git diff --git a/test/unit/core.js b/test/unit/core.js index 98a161f..4d04af7 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -146,7 +146,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" ); } }); @@ -256,18 +256,16 @@ test("isFunction", function() { }); }); -var foo = false; - test("jQuery('html')", function() { 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" ); @@ -460,7 +458,7 @@ test("attr(Hash)", function() { test("attr(String, Object)", function() { expect(19); - var div = jQuery("div").attr("foo", "bar"); + var div = jQuery("div").attr("foo", "bar"), fail = false; for ( var i = 0; i < div.size(); i++ ) { if ( div.get(i).getAttribute('foo') != "bar" ){ @@ -901,7 +899,7 @@ test("append(String|Element|Array<Element>|jQuery)", function() { }); test("appendTo(String|Element|Array<Element>|jQuery)", function() { - expect(6); + expect(7); var defaultText = 'Try them out:' jQuery('buga').appendTo('#first'); equals( jQuery("#first").text(), defaultText + 'buga', 'Check if text appending works' ); @@ -918,6 +916,9 @@ test("appendTo(String|Element|Array<Element>|jQuery)", function() { equals( expected, jQuery('#sap').text(), "Check for appending of array of elements" ); reset(); + ok( jQuery(document.createElement("script")).appendTo("body").length, "Make sure a disconnected script can be appended." ); + + reset(); expected = document.querySelectorAll ? "This link has class=\"blog\": Simon Willison's WeblogYahooTry them out:" : "This link has class=\"blog\": Simon Willison's WeblogTry them out:Yahoo"; @@ -1350,10 +1351,11 @@ test("val(String/Number)", function() { j.removeAttr("value"); }); -var scriptorder = 0; - test("html(String)", function() { - expect(13); + expect(17); + + jQuery.scriptorder = 0; + var div = jQuery("#main > div"); div.html("test"); var pass = true; @@ -1379,6 +1381,10 @@ test("html(String)", function() { equals( $div.html( 5 ).html(), '5', 'Setting a number as html' ); equals( $div.html( 0 ).html(), '0', 'Setting a zero as html' ); + reset(); + + jQuery("#main").html('
'); + stop(); jQuery("#main").html(''); @@ -1386,7 +1392,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("