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

Unified Diff: LayoutTests/fast/js/resources/select-options-remove.js

Issue 23549004: Fix the HTMLSelectElement.prototype.remove() method (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
Index: LayoutTests/fast/js/resources/select-options-remove.js
diff --git a/LayoutTests/fast/js/resources/select-options-remove.js b/LayoutTests/fast/js/resources/select-options-remove.js
index 252b73f38142cfe034a7d4affbd4c7b8b7464e2d..7c1b007fd98c2a392d2651367148a73e3cdc9dc7 100644
--- a/LayoutTests/fast/js/resources/select-options-remove.js
+++ b/LayoutTests/fast/js/resources/select-options-remove.js
@@ -73,7 +73,7 @@ shouldBe("select1.selectedIndex", "-1");
debug("");
debug("1.11 Remove too many args from empty Options");
-shouldBe("select1.options.remove(0, 'foo')", "undefined");
+shouldThrow("select1.options.remove(0, 'foo')");
shouldBe("select1.options.length", "0");
shouldBe("select1.selectedIndex", "-1");
debug("");
@@ -102,6 +102,12 @@ shouldBe("select1.options.length", "0");
shouldBe("select1.selectedIndex", "-1");
debug("");
+debug("1.16 Detach select element");
+shouldNotBe("select1.parentNode", "null");
+shouldBe("select1.remove()", "undefined");
+shouldBeNull("select1.parentNode");
+debug("");
+
// ------------------------------------------------
i = 0;
@@ -195,36 +201,43 @@ shouldBe("select2.options[0].value", "'L'");
debug("");
debug("2.12 Remove too many args from non-empty Options");
-shouldBe("select2.options.remove(0, 'foo')", "undefined");
-shouldBe("select2.options.length", "4");
-shouldBe("select2.selectedIndex", "2");
-shouldBe("select2.options[0].value", "'M'");
+shouldThrow("select2.options.remove(0, 'foo')");
+shouldBe("select2.options.length", "5");
+shouldBe("select2.selectedIndex", "3");
+shouldBe("select2.options[0].value", "'L'");
debug("");
debug("2.13 Remove invalid index -2 from non-empty Options");
shouldBe("select2.options.remove(-2)", "undefined");
-shouldBe("select2.options.length", "4");
-shouldBe("select2.selectedIndex", "2");
-shouldBe("select2.options[2].value", "'O'");
+shouldBe("select2.options.length", "5");
+shouldBe("select2.selectedIndex", "3");
+shouldBe("select2.options[2].value", "'N'");
debug("");
debug("2.14 Remove invalid index -1 from non-empty Options");
shouldBe("select2.options.remove(-1)", "undefined");
-shouldBe("select2.options.length", "4");
-shouldBe("select2.selectedIndex", "2");
-shouldBe("select2.options[3].value", "'P'");
+shouldBe("select2.options.length", "5");
+shouldBe("select2.selectedIndex", "3");
+shouldBe("select2.options[3].value", "'O'");
debug("");
debug("2.15 Remove index 0 from non-empty Options");
shouldBe("select2.options.remove(0)", "undefined");
-shouldBe("select2.options.length", "3");
-shouldBe("select2.selectedIndex", "1");
-shouldBe("select2.options[0].value", "'N'");
+shouldBe("select2.options.length", "4");
+shouldBe("select2.selectedIndex", "2");
+shouldBe("select2.options[0].value", "'M'");
debug("");
debug("2.16 Remove index 1 from non-empty Options");
shouldBe("select2.options.remove(1)", "undefined");
-shouldBe("select2.options.length", "2");
-shouldBe("select2.selectedIndex", "0");
-shouldBe("select2.options[1].value", "'P'");
+shouldBe("select2.options.length", "3");
+shouldBe("select2.selectedIndex", "1");
+shouldBe("select2.options[1].value", "'O'");
debug("");
+
+debug("2.17 Detach select element");
+shouldNotBe("select2.parentNode", "null");
+shouldBe("select2.remove()", "undefined");
+shouldBeNull("select2.parentNode");
+debug("");
+
« no previous file with comments | « no previous file | LayoutTests/fast/js/select-options-remove-expected.txt » ('j') | Source/core/html/HTMLOptionsCollection.idl » ('J')

Powered by Google App Engine
This is Rietveld 408576698