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

Unified Diff: LayoutTests/fast/dom/HTMLOptionElement/collection-setter-getter.html

Issue 143943020: Replace [TreatNullAs=functionName] with [StrictTypeChecking] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update tests, Python, and IDLExtendedAttributes.txt Created 6 years, 11 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/HTMLOptionElement/collection-setter-getter-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/dom/HTMLOptionElement/collection-setter-getter.html
diff --git a/LayoutTests/fast/dom/HTMLOptionElement/collection-setter-getter.html b/LayoutTests/fast/dom/HTMLOptionElement/collection-setter-getter.html
index e5801b3c7d28ac44ad972b8937427735b996f882..fc50eb120217b37f83f82aa6974c3740d127cc2e 100644
--- a/LayoutTests/fast/dom/HTMLOptionElement/collection-setter-getter.html
+++ b/LayoutTests/fast/dom/HTMLOptionElement/collection-setter-getter.html
@@ -1,30 +1,41 @@
-<html>
-<head>
+<!DOCTYPE html>
<script src="../../../resources/js-test.js"></script>
-</head>
-<body>
<form name="my_form">
<select name="set_sel">
- <option id='opt'>========</option>
+ <option id="opt">========
</select>
<select name="get_sel">
- <option id="one">option 1</option>
- <option id="two">option 2</option>
+ <option id="one">option 1
+ <option id="two">option 2
</select>
</form>
<script>
description('Tests the indexed setter and getter for HTMLOptionsCollection.');
+var i = 0;
-document.my_form.set_sel.options[1] = new Option("A");
-document.my_form.set_sel.options[2] = new Option("B");
-shouldBe("my_form.set_sel.options.length", "3");
+var get_options = document.my_form.get_sel.options;
+debug((++i) + ') getting options by index or by getElementById');
+shouldBe('get_options[0]', 'document.getElementById("one")');
+shouldBe('get_options[1]', 'document.getElementById("two")');
-var options = document.my_form.get_sel.options;
-shouldBe("options[0]", "document.getElementById('one')");
-shouldBe("options[1]", "document.getElementById('two')");
+var set_options = document.my_form.set_sel.options;
+debug((++i) + ') setting a few elements to Option values');
+set_options[1] = new Option('A');
+set_options[2] = new Option('B');
+shouldBe('set_options.length', '3');
+
+debug((++i) + ') trying to set an element to a non-Option value: undefined');
+set_options[10] = undefined;
+shouldBe('set_options.length', '3');
+
+debug((++i) + ') trying to set an element to a non-Option value: null');
+set_options[10] = null;
+shouldBe('set_options.length', '3');
+
+debug((++i) + ') trying to set an element to a non-Option value: form (object of incorrect type)');
+shouldThrow('set_options[10] = my_form');
+shouldBe('set_options.length', '3');
</script>
-</body>
-</html>
« no previous file with comments | « no previous file | LayoutTests/fast/dom/HTMLOptionElement/collection-setter-getter-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698