X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fjquery%2FcoreTest.js;h=7be53f738338d7af3f66338ee6033627445c280f;hb=aa424984f7c37956f568512aa94bc16787e4c651;hp=4b29c8f86ea71a546102407ab2eb9a7e6f437d94;hpb=12e63353391f1a556a73fe92bcd8e5f0ac277726;p=jquery.git diff --git a/src/jquery/coreTest.js b/src/jquery/coreTest.js index 4b29c8f..7be53f7 100644 --- a/src/jquery/coreTest.js +++ b/src/jquery/coreTest.js @@ -67,13 +67,9 @@ test("attr(String)", function() { ok( $('#form').attr('action').indexOf("formaction") >= 0, 'Check for action attribute' ); }); -test("attr(String, Function|String)", function() { +test("attr(String, Function)", function() { + expect(1); ok( $('#text1').attr('value', function() { return this.id })[0].value == "text1", "Set value from id" ); - ok( $('#text2').attr('value', "${this.id}")[0].value == "text2", "Set value from id" ); - reset(); - $('#text1, #text2').attr({value: "${this.id + 'foobar'}"}); - ok( $('#text1')[0].value == "text1foobar", "Set value from id" ); - ok( $('#text2')[0].value == "text2foobar", "Set value from id" ); }); test("attr(Hash)", function() { @@ -433,11 +429,20 @@ test("removeClass(String) - add three classes and remove again", function() { ok( pass, "Remove multiple classes" ); }); +test("toggleClass(String)", function() { + var e = $("#firstp"); + ok( !e.is(".test"), "Assert class not present" ); + e.toggleClass("test"); + ok( e.is(".test"), "Assert class present" ); + e.toggleClass("test"); + ok( !e.is(".test"), "Assert class not present" ); +}); + test("removeAttr(String", function() { ok( $('#mark').removeAttr("class")[0].className == "", "remove class" ); }); -test("text(String, Boolean)", function() { +test("text(String)", function() { + expect(1); ok( $("#foo").text("
Hello cruel world!
")[0].innerHTML == "<div><b>Hello</b> cruel world!</div>", "Check escaped text" ); - ok( $("#foo").text("
Hello cruel world!
", true)[0].innerHTML == "Hello cruel world!", "Check stripped text" ); -}); \ No newline at end of file +});