Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Unified Diff: LayoutTests/fast/dom/HTMLSelectElement/select-element-item-argument.html

Issue 21834002: HTMLSelectElement.item() does not behave according to specification (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Move test as advised Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/dom/HTMLSelectElement/select-element-item-argument-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/dom/HTMLSelectElement/select-element-item-argument.html
diff --git a/LayoutTests/fast/dom/HTMLSelectElement/select-element-item-argument.html b/LayoutTests/fast/dom/HTMLSelectElement/select-element-item-argument.html
new file mode 100644
index 0000000000000000000000000000000000000000..bea24532ddfbb19cf80c2a0710be6e65eb76e025
--- /dev/null
+++ b/LayoutTests/fast/dom/HTMLSelectElement/select-element-item-argument.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="help" href="http://www.w3.org/TR/html51/forms.html#dom-select-item">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<select id="target">
+ <option value="a">a</option>
+ <option value="b">b</option>
+ <option value="c">c</option>
+ <option value="d">d</option>
+</select>
+
+<script>
+description("Tests that the HTMLSelectElement.item() argument is correctly validated.");
+
+var select = document.getElementById('target');
+shouldBe("select.__proto__", "HTMLSelectElement.prototype");
+
+// getter Node item(unsigned long index);
+shouldBeEqualToString("select.item(0).value", "a");
+shouldBeEqualToString("select.item(1).value", "b");
+shouldBeEqualToString("select.item(2).value", "c");
+shouldBeEqualToString("select.item(3).value", "d");
+shouldBeNull("select.item(4)");
+shouldBeNull("select.item(-1)"); // Offset is too large (after wrapping)
+shouldBeEqualToString("select.item(-4294967294).value", "c"); // Wraps to 2, which is a valid offset.
+shouldThrow("select.item()", "'TypeError: Not enough arguments'");
+
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/fast/dom/HTMLSelectElement/select-element-item-argument-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698