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

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

Issue 2711183003: Import wpt@a7e9c2abcf65b78fcf1c246fec6681c74e1bc352 (Closed)
Patch Set: Update test expectations and baselines. Created 3 years, 10 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: third_party/WebKit/LayoutTests/external/wpt/html/semantics/forms/the-select-element/selected-index.html
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/forms/the-select-element/selected-index.html b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/forms/the-select-element/selected-index.html
index 1be5378cdf4fae7ad5d717c67b5fff97636a33e3..6c30698a8ae1f79e5db21e8912d19b55d803910f 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/forms/the-select-element/selected-index.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/forms/the-select-element/selected-index.html
@@ -28,46 +28,76 @@
</form>
<script>
+function assertSelectedIndex(select, value) {
+ assert_equals(select.selectedIndex, value);
+ assert_equals(select.options.selectedIndex, value);
+}
+
test(function () {
var select = document.getElementById('empty');
- assert_equals(select.selectedIndex, -1);
+ assertSelectedIndex(select, -1);
}, "get empty");
test(function () {
var select = document.getElementById('default');
- assert_equals(select.selectedIndex, 0);
+ assertSelectedIndex(select, 0);
}, "get default");
test(function () {
var select = document.getElementById('disabled');
- assert_equals(select.selectedIndex, 1);
+ assertSelectedIndex(select, 1);
}, "get disabled");
test(function () {
var select = document.getElementById('selected');
- assert_equals(select.selectedIndex, 1);
+ assertSelectedIndex(select, 1);
}, "get unselected");
test(function () {
var select = document.getElementById('empty');
select.selectedIndex = 1;
- assert_equals(select.selectedIndex, -1);
-}, "set empty");
+ assertSelectedIndex(select, -1);
+}, "set empty (HTMLSelectElement)");
+
+test(function () {
+ var select = document.getElementById('empty');
+ select.options.selectedIndex = 1;
+ assertSelectedIndex(select, -1);
+}, "set empty (HTMLOptionsCollection)");
test(function () {
var select = document.getElementById('default');
- assert_equals(select.selectedIndex, 0);
+ assertSelectedIndex(select, 0);
select.selectedIndex = 2;
- assert_equals(select.selectedIndex, 2);
-}, "set");
+ assertSelectedIndex(select, 2);
+ this.add_cleanup(() => select.selectedIndex = 0);
+}, "set (HTMLSelectElement)");
+
+test(function () {
+ var select = document.getElementById('default');
+ assertSelectedIndex(select, 0);
+ select.options.selectedIndex = 2;
+ assertSelectedIndex(select, 2);
+ this.add_cleanup(() => select.selectedIndex = 0);
+}, "set (HTMLOptionsCollection)");
test(function () {
var select = document.getElementById('selected');
var form = document.getElementById('form');
- assert_equals(select.selectedIndex, 1);
+ assertSelectedIndex(select, 1);
select.selectedIndex = 0;
- assert_equals(select.selectedIndex, 0);
+ assertSelectedIndex(select, 0);
+ form.reset();
+ assertSelectedIndex(select, 1);
+}, "set and reset (HTMLSelectElement)");
+
+test(function () {
+ var select = document.getElementById('selected');
+ var form = document.getElementById('form');
+ assertSelectedIndex(select, 1);
+ select.options.selectedIndex = 0;
+ assertSelectedIndex(select, 0);
form.reset();
- assert_equals(select.selectedIndex, 1);
-}, "set and reset");
+ assertSelectedIndex(select, 1);
+}, "set and reset (HTMLOptionsCollection)");
</script>

Powered by Google App Engine
This is Rietveld 408576698