Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / option-properties.html
blobfceaa4891be211e6156c95f8cb9ae13a76759512
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.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");
35 </script>
36 </head>
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>
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>