Implemented #756, making text(String) really useful
[jquery.git] / src / jquery / coreTest.js
index 169380b..78d4a27 100644 (file)
@@ -67,9 +67,13 @@ test("attr(String)", function() {
        ok( $('#form').attr('action').indexOf("formaction") >= 0, 'Check for action attribute' );\r
 });\r
 \r
-test("attr(String, Function)", function() {\r
+test("attr(String, Function|String)", function() {\r
        ok( $('#text1').attr('value', function() { return this.id })[0].value == "text1", "Set value from id" );\r
        ok( $('#text2').attr('value', "${this.id}")[0].value == "text2", "Set value from id" );\r
+       reset();\r
+       $('#text1, #text2').attr({value: "${this.id + 'foobar'}"});\r
+       ok( $('#text1')[0].value == "text1foobar", "Set value from id" );\r
+       ok( $('#text2')[0].value == "text2foobar", "Set value from id" );\r
 });\r
 \r
 test("attr(Hash)", function() {\r
@@ -431,3 +435,7 @@ test("removeAttr(String", function() {
        ok( $('#mark').removeAttr("class")[0].className == "", "remove class" );\r
 });\r
 \r
+test("text(String, Boolean)", function() {\r
+       ok( $("#foo").text("<div><b>Hello</b> cruel world!</div>")[0].innerHTML == "&lt;div&gt;&lt;b&gt;Hello&lt;/b&gt; cruel world!&lt;/div&gt;", "Check escaped text" );\r
+       ok( $("#foo").text("<div><b>Hello</b> cruel world!</div>", true)[0].innerHTML == "Hello cruel world!", "Check stripped text" );\r
+});
\ No newline at end of file