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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/forms/text/text-change-event-after-clear-in-submit.html

Issue 2716773002: INPUT element: Implicit form submission should reset setTextAsOfLastFormControlChangeEvent. (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLInputElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <body>
3 <script src="../../../resources/testharness.js"></script>
4 <script src="../../../resources/testharnessreport.js"></script>
5 <form><input><input type=submit></form>
6 <script>
7 test(() => {
8 assert_exists(window, 'eventSender');
9 let form = document.querySelector('form');
10 let text = document.querySelector('input');
11 let submit = document.querySelectorAll('input')[1];
12 var lastChangeValue = '';
13 form.addEventListener('submit', (event) => {
14 text.value = '';
15 event.preventDefault();
16 });
17 text.addEventListener('change', () => { lastChangeValue = text.value; });
18
19 text.focus();
20 eventSender.keyDown('f');
21 eventSender.keyDown('Enter'); // Trigger implicit submission
22 assert_equals(lastChangeValue, 'f');
23 lastChangeValue = null;
24 assert_equals(document.activeElement, text);
25 assert_equals(text.value, '');
26
27 eventSender.keyDown('f');
28 eventSender.keyDown('Enter'); // Trigger implicit submission again.
29 assert_equals(lastChangeValue, 'f', 'The second submission should trigger chan ge event.');
30
31 }, 'Clearing INPUT value in submit event handler should not prevent next change event. crbug.com/695349');
32 </script>
33 </body>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLInputElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698