2008-11-04 Anders Carlsson <andersca@apple.com>
[webkit/qt.git] / LayoutTests / fast / dom / option-properties.html
blob653bb0a204fb7c50e5c4397523f4596ed8c2bdb9
1 <html>
2 <head>
3 <script>
4 function print(message, color)
6 var paragraph = document.createElement("div");
7 paragraph.appendChild(document.createTextNode(message));
8 paragraph.style.fontFamily = "monospace";
9 if (color)
10 paragraph.style.color = color;
11 document.getElementById("console").appendChild(paragraph);
14 function shouldBe(a, b)
16 var evalA = eval(a);
17 if (evalA == b)
18 print("PASS: " + a + " should be " + b + " and is.", "green");
19 else
20 print("FAIL: " + a + " should be " + b + " but instead is " + evalA + ".", "red");
23 function test()
25 if (window.layoutTestController)
26 layoutTestController.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");
35 </script>
36 </head>
38 <body onload="test();">
39 <p>This page tests setting 'selected' and 'text' on an option element. See <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=9095">http://bugzilla.opendarwin.org/show_bug.cgi?id=9095</a>.</p>
40 <p>If the test passes, you'll see a series of 'PASS' messages below.</p>
41 <hr>
42 <div id='console'></div>
44 <form>
45 <select id='sel'>
46 <option value='bad'>FAIL</option>
47 <option value='good'>FAIL</option>
48 </select>
49 </form>
51 </body>
52 </html>