X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fjquery%2FcoreTest.js;h=497d30dbd4392412591f627fc0770ace6a0ebd7a;hb=1878aa96446aae7aa65ccbbd8a1dfa90301a043a;hp=a75331558ab339e50ffc4538fe481d09a593d30f;hpb=de4e28e1ba8cad85818b298009dca8098005c673;p=jquery.git diff --git a/src/jquery/coreTest.js b/src/jquery/coreTest.js index a753315..497d30d 100644 --- a/src/jquery/coreTest.js +++ b/src/jquery/coreTest.js @@ -74,7 +74,7 @@ test("index(Object)", function() { }); test("attr(String)", function() { - expect(13); + 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' ); @@ -87,7 +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' ); - ok( $('#anchor2').attr('href') == "#2", 'Check for non-absolute href (an anchor)' ); + //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() { @@ -204,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' ); @@ -233,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() { @@ -415,7 +426,7 @@ test("clone()", function() { }); test("is(String)", function() { - expect(22); + expect(26); ok( $('#form').is('form'), 'Check for element: A form must be a form' ); ok( !$('#form').is('div'), 'Check for element: A form is not a div' ); ok( $('#mark').is('.blog'), 'Check for class: Expected class "blog"' ); @@ -438,6 +449,12 @@ test("is(String)", function() { ok( !$('#foo').is(null), 'Expected false for an invalid expression - null' ); ok( !$('#foo').is(''), 'Expected false for an invalid expression - ""' ); ok( !$('#foo').is(undefined), 'Expected false for an invalid expression - undefined' ); + + // test is() with comma-seperated expressions + ok( $('#en').is('[@lang="en"],[@lang="de"]'), 'Check for lang attribute: Expecte en or de' ); + ok( $('#en').is('[@lang="de"],[@lang="en"]'), 'Check for lang attribute: Expecte en or de' ); + ok( $('#en').is('[@lang="en"] , [@lang="de"]'), 'Check for lang attribute: Expecte en or de' ); + ok( $('#en').is('[@lang="de"] , [@lang="en"]'), 'Check for lang attribute: Expecte en or de' ); }); test("$.extend(Object, Object)", function() {