X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fjquery%2FcoreTest.js;h=1410ece7c34a8143c818550528dd837c828b7dcd;hb=ecaa4d4570b05610d542b971fc4278de3c251e79;hp=a7b470e09b354ff7aba14a5ec94fcda82f8e6fb9;hpb=d9464547e0c328bf9f9b67e8d38621023a7e450e;p=jquery.git diff --git a/src/jquery/coreTest.js b/src/jquery/coreTest.js index a7b470e..1410ece 100644 --- a/src/jquery/coreTest.js +++ b/src/jquery/coreTest.js @@ -14,6 +14,9 @@ test("Basic requirements", function() { test("$()", function() { var main = $("#main"); isSet( $("div p", main).get(), q("sndp", "en", "sap"), "Basic selector with jQuery object as context" ); + + // make sure this is handled + $('

\r\n

'); }); test("length", function() { @@ -71,7 +74,7 @@ test("index(Object)", function() { }); test("attr(String)", function() { - expect(12); + expect(14); ok( $('#text1').attr('value') == "Test", 'Check for value attribute' ); ok( $('#text1').attr('type') == "text", 'Check for type attribute' ); ok( $('#radio1').attr('type') == "radio", 'Check for type attribute' ); @@ -84,6 +87,13 @@ test("attr(String)", function() { ok( $('#name').attr('name') == "name", 'Check for name attribute' ); ok( $('#text1').attr('name') == "action", 'Check for name attribute' ); ok( $('#form').attr('action').indexOf("formaction") >= 0, 'Check for action attribute' ); + //equals( "#2", $('#anchor2').attr('href'), 'Check for non-absolute href (an anchor)' ); This fails in IE because the _config.fixture is reloaded using innerHTML + 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() { @@ -102,7 +112,7 @@ test("attr(Hash)", function() { }); test("attr(String, Object)", function() { - expect(6); + expect(7); var div = $("div"); div.attr("foo", "bar"); var pass = true; @@ -110,6 +120,8 @@ test("attr(String, Object)", function() { if ( div.get(i).getAttribute('foo') != "bar" ) pass = false; } ok( pass, "Set Attribute" ); + + ok( $("#foo").attr({"width": null}), "Try to set an attribute to nothing" ); $("#name").attr('name', 'something'); ok( $("#name").attr('name') == 'something', 'Set name attribute' ); @@ -198,7 +210,7 @@ test("wrap(String|Element)", function() { }); test("append(String|Element|Array<Element>|jQuery)", function() { - expect(9); + expect(10); var defaultText = 'Try them out:' var result = $('#first').append('buga'); ok( result.text() == defaultText + 'buga', 'Check if text appending works' ); @@ -227,6 +239,11 @@ test("append(String|Element|Array<Element>|jQuery)", function() { ok( $("#sap").append([]), "Check for appending an empty array." ); ok( $("#sap").append(""), "Check for appending an empty string." ); ok( $("#sap").append(document.getElementsByTagName("foo")), "Check for appending an empty nodelist." ); + + reset(); + $("#sap").append(document.getElementById('form')); + ok( $("#sap>form").size() == 1, "Check for appending a form" ); + }); test("appendTo(String|Element|Array<Element>|jQuery)", function() {