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

Unified Diff: third_party/WebKit/LayoutTests/fast/forms/select/select-ask-for-reset.html

Issue 1838183003: Fix problems on changing 'multiple' state SELECT element to 'single' state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a typo in a comment Created 4 years, 9 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/fast/forms/select/select-ask-for-reset.html
diff --git a/third_party/WebKit/LayoutTests/fast/forms/select/select-ask-for-reset.html b/third_party/WebKit/LayoutTests/fast/forms/select/select-ask-for-reset.html
index 3f2b430480efe4e494a8e9bf21698852c5281168..5102576d99c415ff36a31319f888dbf049c6975d 100644
--- a/third_party/WebKit/LayoutTests/fast/forms/select/select-ask-for-reset.html
+++ b/third_party/WebKit/LayoutTests/fast/forms/select/select-ask-for-reset.html
@@ -49,5 +49,21 @@ test(function() {
select.removeChild(select.lastChild);
assert_equals(select.selectedIndex, 0);
}, 'Removing an OPTION from a SELECT element should reset selection.');
+
+test(function() {
+ var select = document.createElement('select');
+ select.multiple = true;
+ select.innerHTML = '<option selected>foo</option><option selected>bar</option>';
+ document.body.appendChild(select);
+ select.removeAttribute('multiple');
+ assert_equals(select.selectedOptions.length, 1);
+ assert_equals(select.selectedIndex, 0, 'The first selected OPTION should be chosen.');
+
+ select.selectedIndex = -1;
+ select.multiple = true;
+ select.multiple = false;
+ assert_equals(select.selectedOptions.length, 1);
+ assert_equals(select.selectedIndex, 0);
+}, 'Changing multiple SELECT to single should reset selection.');
</script>
</body>

Powered by Google App Engine
This is Rietveld 408576698