4 <script src=
"../../../resources/js-test.js"></script>
7 <select id=
"theSelect">
8 <option value=
"a">A
</option>
9 <option value=
"b">B
</option>
11 <select id=
"theMultipleSelect" multiple
>
12 <option value=
"a">A
</option>
13 <option value=
"b">B
</option>
14 <option value=
"c">C
</option>
15 <option value=
"d">D
</option>
17 <div id=
"console"></div>
20 description("https://bugs.webkit.org/show_bug.cgi?id=67233 - Setting the value of a select to an invalid value should unset the selection.");
22 function resetSingleSelect() {
24 shouldBe("sel.selectedIndex", "0", true);
27 function resetMultipleSelect() {
28 sel
.item(1).selected
= true;
29 sel
.item(3).selected
= true;
32 function runTestsOnSelect(resetSelect
) {
33 debug("Setting the value to an invalid value:");
36 shouldBe("sel.selectedIndex", "-1");
38 debug("Setting the value to null:");
41 shouldBe("sel.selectedIndex", "-1");
43 debug("Setting the value to undefined:");
45 sel
.value
= undefined;
46 shouldBe("sel.selectedIndex", "-1");
49 debug("-- Menu list select:");
50 sel
= document
.getElementById("theSelect");
51 runTestsOnSelect(resetSingleSelect
);
53 debug("-- List box select:");
54 sel
= document
.getElementById("theMultipleSelect");
55 runTestsOnSelect(resetMultipleSelect
);
57 successfullyParsed
= true;