X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fjquery%2FcoreTest.js;h=7dd7a16bb789b720b634dcc020ae1ed85fa9003a;hb=ccc4c7663a117f4a9c5469f086d18133ae4f2e38;hp=efee85b35701052f545adb780caafe25e39250ee;hpb=ef1ee513d314123017fce770e8fe0a9c85b9eb87;p=jquery.git diff --git a/src/jquery/coreTest.js b/src/jquery/coreTest.js index efee85b..7dd7a16 100644 --- a/src/jquery/coreTest.js +++ b/src/jquery/coreTest.js @@ -263,20 +263,6 @@ test("filter()", function() { isSet( $("p").filter(["#ap", "#sndp"]).get(), q("ap", "sndp"), "filter(Array<String>)" ); }); -test("filter(String) - execute callback in fitting context", function() { - expect(1); - $("input").filter(":checked",function(i){ - ok( this == q("radio2", "check1")[i], "Filter elements, context" ); - }); -}); - -test("filter(String) - execute callback in not-fitting context", function() { - expect(1); - $("#main > p#ap > a").filter("#foobar",function(){},function(i){ - ok( this == q("google","groups", "mark")[i], "Filter elements, else context" ); - }); -}); - test("not(String)", function() { ok($("#main > p#ap > a").not("#google").length == 2, "not('selector')") isSet( $("p").not("#ap, #sndp").get(), q("firstp", "en", "sap", "first", "result"), "not('selector, selector')" ); @@ -345,11 +331,15 @@ test("expressions - element", function() { }); test("expressions - id", function() { - expect(5); + expect(8); t( "ID Selector", "#body", ["body"] ); t( "ID Selector w/ Element", "body#body", ["body"] ); t( "ID Selector w/ Element", "ul#first", [] ); + t( "ID Selector, child ID present", "#form > #radio1", ["radio1"] ); // bug #267 + t( "ID Selector, not an ancestor ID", "#form #first", [] ); + t( "ID Selector, not a child ID", "#form > #option1a", [] ); + t( "All Children of ID", "#foo/*", ["sndp", "en", "sap"] ); t( "All Children of ID with no children", "#firstUL/*", [] ); }); @@ -389,7 +379,7 @@ test("expressions - child and adjacent", function() { }); test("expressions - attributes", function() { - expect(16); + expect(19); t( "Attribute Exists", "a[@title]", ["google"] ); t( "Attribute Exists", "*[@title]", ["google"] ); t( "Attribute Exists", "[@title]", ["google"] ); @@ -405,6 +395,10 @@ test("expressions - attributes", function() { t( "Attribute Ends With", "a[@href $= 'org/']", ["mark"] ); t( "Attribute Contains", "a[@href *= 'google']", ["google","groups"] ); + t("Select options via [@selected]", "#select1 option[@selected]", ["option1a"] ); + t("Select options via [@selected]", "#select2 option[@selected]", ["option2d"] ); + t("Select options via [@selected]", "#select3 option[@selected]", ["option3b", "option3c"] ); + t( "Grouped Form Elements", "input[@name='foo[bar]']", ["hidden2"] ); t( ":not() Existing attribute", "select:not([@multiple])", ["select1", "select2"]); @@ -564,4 +558,8 @@ test("removeClass(String) - add three classes and remove again", function() { if ( div.get(i).className.match(/test|bar|foo/) ) pass = false; } ok( pass, "Remove multiple classes" ); +}); + +test("removeAttr(String", function() { + ok( $('#mark').removeAttr("class")[0].className == "", "remove class" ); }); \ No newline at end of file