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> |