X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjquery%2FcoreTest.js;h=73621cd178d6f5873c6198fd84d74ec9f9ffb730;hb=d0e8a2452ebd30abe403d402e813513cef675694;hp=436dcc5cbe579c9f95f63e1dd32205bfa953b6bb;hpb=cb0250f1fa5af5c84e858ea978fcaa1194f4694f;p=jquery.git diff --git a/src/jquery/coreTest.js b/src/jquery/coreTest.js index 436dcc5..73621cd 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() { @@ -107,19 +103,21 @@ test("attr(String, Object)", function() { ok( document.getElementById('text1').readOnly == false, 'Set readonly attribute' ); }); -test("attr(String, Object)x", 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 ( location.protocol != "file:" ) { + test("attr(String, Object)x", 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(8); @@ -435,3 +433,7 @@ test("removeAttr(String", function() { ok( $('#mark').removeAttr("class")[0].className == "", "remove class" ); }); +test("text(String, Boolean)", function() { + 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" ); +});