4 function print(message
, color
)
6 var paragraph
= document
.createElement("div");
7 paragraph
.appendChild(document
.createTextNode(message
));
8 paragraph
.style
.fontFamily
= "monospace";
10 paragraph
.style
.color
= color
;
11 document
.getElementById("console").appendChild(paragraph
);
14 function shouldBe(a
, b
)
18 print("PASS: " + a
+ " should be " + b
+ " and is.", "green");
20 print("FAIL: " + a
+ " should be " + b
+ " but instead is " + evalA
+ ".", "red");
25 if (window
.testRunner
)
26 testRunner
.dumpAsText();
28 document
.getElementById('sel').options
[1].selected
= true;
29 shouldBe("document.getElementById('sel').options.selectedIndex", 1);
30 shouldBe("document.getElementById('sel').options[1].selected", true);
32 document
.getElementById('sel').options
[1].text
= "PASS";
33 shouldBe("document.getElementById('sel').options[1].text", "PASS");
38 <body onload=
"test();">
39 <p>This page tests setting 'selected' and 'text' on an option element. See
<a href=
"https://bugs.webkit.org/show_bug.cgi?id=9095">https://bugs.webkit.org/show_bug.cgi?id=
9095</a>.
</p>
40 <p>If the test passes, you'll see a series of 'PASS' messages below.
</p>
42 <div id='console'
></div>
46 <option value='bad'
>FAIL
</option>
47 <option value='good'
>FAIL
</option>