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

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

Issue 1837463002: Improve conformance of default OPTION selection of SELECT element (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renaming to resetToDefaultSelection Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <body> 2 <body>
3 <script src="../../../resources/testharness.js"></script> 3 <script src="../../../resources/testharness.js"></script>
4 <script src="../../../resources/testharnessreport.js"></script> 4 <script src="../../../resources/testharnessreport.js"></script>
5 <link rel="help" href="https://html.spec.whatwg.org/multipage/forms.html#ask-for -a-reset"> 5 <link rel="help" href="https://html.spec.whatwg.org/multipage/forms.html#ask-for -a-reset">
6 <div id="log"></div> 6 <div id="log"></div>
7 <script> 7 <script>
8 test(function() { 8 test(function() {
9 var select = document.createElement('select'); 9 var select = document.createElement('select');
10 select.innerHTML = '<option>foo</option>'; 10 select.innerHTML = '<option>foo</option>';
(...skipping 22 matching lines...) Expand all
33 test(function() { 33 test(function() {
34 var form = document.createElement('form'); 34 var form = document.createElement('form');
35 document.body.appendChild(form); 35 document.body.appendChild(form);
36 var select = document.createElement('select'); 36 var select = document.createElement('select');
37 form.appendChild(select); 37 form.appendChild(select);
38 select.innerHTML = '<option disabled>Apple</option><option>Banana</option><o ption>Cherry</option>'; 38 select.innerHTML = '<option disabled>Apple</option><option>Banana</option><o ption>Cherry</option>';
39 assert_equals(select.selectedIndex, 1); 39 assert_equals(select.selectedIndex, 1);
40 form.reset(); 40 form.reset();
41 assert_equals(select.selectedIndex, 1); 41 assert_equals(select.selectedIndex, 1);
42 }, 'Reset should select the first option element in the list of options that is not disabled to true'); 42 }, 'Reset should select the first option element in the list of options that is not disabled to true');
43
44 test(function() {
45 var select = document.createElement('select');
46 select.innerHTML = '<option>foo</option><option>bar</option>';
47 document.body.appendChild(select);
48 select.selectedIndex = -1;
49 select.removeChild(select.lastChild);
50 assert_equals(select.selectedIndex, 0);
51 }, 'Removing an OPTION from a SELECT element should reset selection.');
43 </script> 52 </script>
44 </body> 53 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698