Use testRunner instead of layoutTestController in fast/doctypes, dom, dynamic, encodi...
[WebKit-https.git] / LayoutTests / fast / dom / HTMLSelectElement / listbox-select-reset.html
1 <head>
2 </head>
3 <body>
4 <form>
5 <select id="multiSelectElement" multiple="mulitple">
6 <option>one</option>
7 <option>two</option>
8 <option>three</option>
9 </select>
10 <select id="singleSelectElement" size="3">
11 <option>one</option>
12 <option>two</option>
13 <option>three</option>
14 </select>
15 <input id="resetButton" type="reset">
16 </form>
17 <p>This test verifies that list-box-style select form controls with no 
18 "selected" attributes are properly cleared when reset.
19 <p>You should see two element IDs below, and the word "SUCCESS" twice:
20 <script>
21 if (window.testRunner)
22     testRunner.dumpAsText();
23 var button = document.getElementById("resetButton");
24
25 function test(elementId)
26 {
27     var testSelectElement = document.getElementById(elementId);
28     var result = "FAILED";
29     if (testSelectElement.selectedIndex == -1)
30     {
31         testSelectElement.selectedIndex = 1;
32         button.click();
33         if (testSelectElement.selectedIndex == -1)
34             result = "SUCCESS";
35     }
36     document.writeln("<p>" + elementId + ": " + result + "</p>");
37 }
38 test("multiSelectElement");
39 test("singleSelectElement");
40 </script>
41 </body>
42 </html>