X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=test%2Funit%2Fcore.js;h=32ff83e8613a32c2dfba93fedff7d3481aa2dfd0;hb=0f5c1d15e974fdc44f4f2182e07d4ed6f9a37707;hp=db47856095e3a2f2ce98af219b3b24c083e7f2bb;hpb=6728e3cf74d02794113deb0af70a5f9a7caa2241;p=jquery.git diff --git a/test/unit/core.js b/test/unit/core.js index db47856..32ff83e 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -123,11 +123,18 @@ test("isFunction", function() { }); }); +var foo = false; + test("$('html')", function() { - expect(2); + expect(4); reset(); - ok( $("")[0], "Creating a script" ); + foo = false; + var s = $("")[0]; + ok( s, "Creating a script" ); + ok( !foo, "Make sure the script wasn't executed prematurely" ); + $("body").append(s); + ok( foo, "Executing a scripts contents in the right context" ); reset(); ok( $("")[0], "Creating a link" ); @@ -213,15 +220,17 @@ test("attr(String)", function() { ok( $('#tAnchor5').attr('href') == "#5", 'Check for non-absolute href (an anchor)' ); }); -test("attr(String) in XML Files", function() { - expect(2); - stop(); - $.get("data/dashboard.xml", function(xml) { - ok( $("locations", xml).attr("class") == "foo", "Check class attribute in XML document" ); - ok( $("location", xml).attr("for") == "bar", "Check for attribute in XML document" ); - start(); - }); -}); +if ( !isLocal ) { + test("attr(String) in XML Files", function() { + expect(2); + stop(); + $.get("data/dashboard.xml", function(xml) { + ok( $("locations", xml).attr("class") == "foo", "Check class attribute in XML document" ); + ok( $("location", xml).attr("for") == "bar", "Check for attribute in XML document" ); + start(); + }); + }); +} test("attr(String, Function)", function() { expect(2); @@ -286,19 +295,21 @@ test("attr(String, Object)", function() { equals( "checkbox", $(check).attr('type'), "Verify that you can change the type of an input element that isn't in the DOM" ); }); -test("attr(String, Object) - Loaded via XML document", function() { - expect(2); - stop(); - $.get('data/dashboard.xml', function(xml) { - var titles = []; - $('tab', xml).each(function() { - titles.push($(this).attr('title')); - }); - ok( titles[0] == 'Location', 'attr() in XML context: Check first title' ); - ok( titles[1] == 'Users', 'attr() in XML context: Check second title' ); - start(); - }); -}); +if ( !isLocal ) { + test("attr(String, Object) - Loaded via XML document", function() { + expect(2); + stop(); + $.get('data/dashboard.xml', function(xml) { + var titles = []; + $('tab', xml).each(function() { + titles.push($(this).attr('title')); + }); + ok( titles[0] == 'Location', 'attr() in XML context: Check first title' ); + ok( titles[1] == 'Users', 'attr() in XML context: Check second title' ); + start(); + }); + }); +} test("css(String|Hash)", function() { expect(19); @@ -821,7 +832,7 @@ test("val(String)", function() { }); test("html(String)", function() { - expect(1); + expect(3); var div = $("div"); div.html("test"); var pass = true; @@ -830,8 +841,13 @@ test("html(String)", function() { } ok( pass, "Set HTML" ); - // Ccommented out until we can resolve it - // $("#main").html('').evalScripts(); + stop(); + + $("#main").html(''); + + $("#main").html('foo
'); + + setTimeout( start, 100 ); }); test("filter()", function() { @@ -1029,11 +1045,13 @@ test("empty()", function() { }); test("slice()", function() { - expect(4); + expect(5); isSet( $("#ap a").slice(1,2), q("groups"), "slice(1,2)" ); isSet( $("#ap a").slice(1), q("groups", "anchor1", "mark"), "slice(1)" ); isSet( $("#ap a").slice(0,3), q("google", "groups", "anchor1"), "slice(0,3)" ); isSet( $("#ap a").slice(-1), q("mark"), "slice(-1)" ); + + isSet( $("#ap a").eq(1), q("groups"), "eq(1)" ); }); test("map()", function() {