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

Unified Diff: third_party/WebKit/LayoutTests/imported/wpt/html/semantics/forms/the-select-element/selected-index.html

Issue 2468053002: Import wpt@9fcccf38b6be00f71ffa6bd6e29c5aa1ef25ee8c (Closed)
Patch Set: Skip cssom and svg/shapes, remove unwanted baseline Created 4 years, 1 month 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: third_party/WebKit/LayoutTests/imported/wpt/html/semantics/forms/the-select-element/selected-index.html
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/html/semantics/forms/the-select-element/selected-index.html b/third_party/WebKit/LayoutTests/imported/wpt/html/semantics/forms/the-select-element/selected-index.html
new file mode 100644
index 0000000000000000000000000000000000000000..1be5378cdf4fae7ad5d717c67b5fff97636a33e3
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/wpt/html/semantics/forms/the-select-element/selected-index.html
@@ -0,0 +1,73 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>HTMLSelectElement selectedIndex</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id=log></div>
+
+<form id=form>
+ <select id=empty></select>
+
+ <select id=default>
+ <option></option>
+ <option></option>
+ <option></option>
+ <option></option>
+ <option></option>
+ </select>
+
+ <select id=disabled>
+ <option disabled></option>
+ <option></option>
+ </select>
+
+ <select id=selected>
+ <option></option>
+ <option selected></option>
+ </select>
+</form>
+
+<script>
+test(function () {
+ var select = document.getElementById('empty');
+ assert_equals(select.selectedIndex, -1);
+}, "get empty");
+
+test(function () {
+ var select = document.getElementById('default');
+ assert_equals(select.selectedIndex, 0);
+}, "get default");
+
+test(function () {
+ var select = document.getElementById('disabled');
+ assert_equals(select.selectedIndex, 1);
+}, "get disabled");
+
+test(function () {
+ var select = document.getElementById('selected');
+ assert_equals(select.selectedIndex, 1);
+}, "get unselected");
+
+test(function () {
+ var select = document.getElementById('empty');
+ select.selectedIndex = 1;
+ assert_equals(select.selectedIndex, -1);
+}, "set empty");
+
+test(function () {
+ var select = document.getElementById('default');
+ assert_equals(select.selectedIndex, 0);
+ select.selectedIndex = 2;
+ assert_equals(select.selectedIndex, 2);
+}, "set");
+
+test(function () {
+ var select = document.getElementById('selected');
+ var form = document.getElementById('form');
+ assert_equals(select.selectedIndex, 1);
+ select.selectedIndex = 0;
+ assert_equals(select.selectedIndex, 0);
+ form.reset();
+ assert_equals(select.selectedIndex, 1);
+}, "set and reset");
+</script>

Powered by Google App Engine
This is Rietveld 408576698