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

Unified 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, 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLInputElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/forms/text/text-change-event-after-clear-in-submit.html
diff --git a/third_party/WebKit/LayoutTests/fast/forms/text/text-change-event-after-clear-in-submit.html b/third_party/WebKit/LayoutTests/fast/forms/text/text-change-event-after-clear-in-submit.html
new file mode 100644
index 0000000000000000000000000000000000000000..29983153e64862e987c5acdc42281ed07e7aea5c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/forms/text/text-change-event-after-clear-in-submit.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<body>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<form><input><input type=submit></form>
+<script>
+test(() => {
+ assert_exists(window, 'eventSender');
+ let form = document.querySelector('form');
+ let text = document.querySelector('input');
+ let submit = document.querySelectorAll('input')[1];
+ var lastChangeValue = '';
+ form.addEventListener('submit', (event) => {
+ text.value = '';
+ event.preventDefault();
+ });
+ text.addEventListener('change', () => { lastChangeValue = text.value; });
+
+ text.focus();
+ eventSender.keyDown('f');
+ eventSender.keyDown('Enter'); // Trigger implicit submission
+ assert_equals(lastChangeValue, 'f');
+ lastChangeValue = null;
+ assert_equals(document.activeElement, text);
+ assert_equals(text.value, '');
+
+ eventSender.keyDown('f');
+ eventSender.keyDown('Enter'); // Trigger implicit submission again.
+ assert_equals(lastChangeValue, 'f', 'The second submission should trigger change event.');
+
+}, 'Clearing INPUT value in submit event handler should not prevent next change event. crbug.com/695349');
+</script>
+</body>
« 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