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

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

Issue 1604653005: Reset algorithm is incorrect for select element with first option disabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLSelectElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 11 matching lines...) Expand all
22 document.body.appendChild(select); 22 document.body.appendChild(select);
23 select.innerHTML = '<option>foo</option>'; 23 select.innerHTML = '<option>foo</option>';
24 assert_equals(select.selectedIndex, 0); 24 assert_equals(select.selectedIndex, 0);
25 select.value = ''; 25 select.value = '';
26 assert_equals(select.selectedIndex, -1); 26 assert_equals(select.selectedIndex, -1);
27 document.body.removeChild(select); 27 document.body.removeChild(select);
28 // removeChild shouldn't change selection because it didn't change the 28 // removeChild shouldn't change selection because it didn't change the
29 // option list. 29 // option list.
30 assert_equals(select.selectedIndex, -1); 30 assert_equals(select.selectedIndex, -1);
31 }, 'Removing a SELECT tree from another tree should not reset selection.'); 31 }, 'Removing a SELECT tree from another tree should not reset selection.');
32
33 test(function() {
34 var form = document.createElement('form');
35 document.body.appendChild(form);
36 var select = document.createElement('select');
37 form.appendChild(select);
38 select.innerHTML = '<option disabled>Apple</option><option>Banana</option><o ption>Cherry</option>';
39 assert_equals(select.selectedIndex, 1);
40 form.reset();
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');
32 </script> 43 </script>
33 </body> 44 </body>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLSelectElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698