OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <link rel="help" href="http://www.w3.org/TR/html51/forms.html#dom-select-item"> | 4 <link rel="help" href="http://www.w3.org/TR/html51/forms.html#dom-select-item"> |
5 <script src="../../js/resources/js-test-pre.js"></script> | 5 <script src="../../../resources/js-test.js"></script> |
6 </head> | 6 </head> |
7 <body> | 7 <body> |
8 <select id="target"> | 8 <select id="target"> |
9 <option value="a">a</option> | 9 <option value="a">a</option> |
10 <option value="b">b</option> | 10 <option value="b">b</option> |
11 <option value="c">c</option> | 11 <option value="c">c</option> |
12 <option value="d">d</option> | 12 <option value="d">d</option> |
13 </select> | 13 </select> |
14 | 14 |
15 <script> | 15 <script> |
16 description("Tests that the HTMLSelectElement.item() argument is correctly valid
ated."); | 16 description("Tests that the HTMLSelectElement.item() argument is correctly valid
ated."); |
17 | 17 |
18 var select = document.getElementById('target'); | 18 var select = document.getElementById('target'); |
19 shouldBe("select.__proto__", "HTMLSelectElement.prototype"); | 19 shouldBe("select.__proto__", "HTMLSelectElement.prototype"); |
20 | 20 |
21 // getter Node item(unsigned long index); | 21 // getter Node item(unsigned long index); |
22 shouldBeEqualToString("select.item(0).value", "a"); | 22 shouldBeEqualToString("select.item(0).value", "a"); |
23 shouldBeEqualToString("select.item(1).value", "b"); | 23 shouldBeEqualToString("select.item(1).value", "b"); |
24 shouldBeEqualToString("select.item(2).value", "c"); | 24 shouldBeEqualToString("select.item(2).value", "c"); |
25 shouldBeEqualToString("select.item(3).value", "d"); | 25 shouldBeEqualToString("select.item(3).value", "d"); |
26 shouldBeNull("select.item(4)"); | 26 shouldBeNull("select.item(4)"); |
27 shouldBeNull("select.item(-1)"); // Offset is too large (after wrapping) | 27 shouldBeNull("select.item(-1)"); // Offset is too large (after wrapping) |
28 shouldBeEqualToString("select.item(-4294967294).value", "c"); // Wraps to 2, whi
ch is a valid offset. | 28 shouldBeEqualToString("select.item(-4294967294).value", "c"); // Wraps to 2, whi
ch is a valid offset. |
29 shouldThrow("select.item()", '"TypeError: Failed to execute \'item\' on \'HTMLSe
lectElement\': 1 argument required, but only 0 present."'); | 29 shouldThrow("select.item()", '"TypeError: Failed to execute \'item\' on \'HTMLSe
lectElement\': 1 argument required, but only 0 present."'); |
30 | 30 |
31 </script> | 31 </script> |
32 </body> | 32 </body> |
33 </html> | 33 </html> |
OLD | NEW |