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

Unified Diff: LayoutTests/fast/forms/text/text-window-lost-focus-change-event.html

Issue 205033004: Dispatch change and blur event for input type=text when window focus is changed (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed toHTML conversion and added setFocus(true) for focus Created 6 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
« no previous file with comments | « no previous file | LayoutTests/fast/forms/text/text-window-lost-focus-change-event-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/forms/text/text-window-lost-focus-change-event.html
diff --git a/LayoutTests/fast/forms/text/text-window-lost-focus-change-event.html b/LayoutTests/fast/forms/text/text-window-lost-focus-change-event.html
new file mode 100644
index 0000000000000000000000000000000000000000..28c7829ccc981d96476613c41fadfb3e059ef96d
--- /dev/null
+++ b/LayoutTests/fast/forms/text/text-window-lost-focus-change-event.html
@@ -0,0 +1,35 @@
+<html>
+<head>
+<script src = "../../../resources/js-test.js"> </script>
+</head>
+<body onload="runTest()">
+<input type="text" id="text"/>
+<script>
+
+var blurEventCounter = 0;
+var changeEventCounter = 0;
+
+function runTest() {
+ description('Test when window out of focus, should dispatch both blur and change event');
+ var text = document.getElementById('text');
+ text.addEventListener('change', function() {
+ changeEventCounter++;
+ });
+ text.addEventListener('blur', function() {
+ blurEventCounter++;
+ shouldEvaluateTo('blurEventCounter', 1);
+ shouldEvaluateTo('changeEventCounter', 1);
+ finishJSTest();
+ });
+ text.focus();
+ document.execCommand('InsertText', false, 'hello world');
+ shouldEvaluateTo('blurEventCounter', 0);
+ shouldEvaluateTo('changeEventCounter', 0);
+ window.testRunner.setMainFrameIsFirstResponder(true);
+ window.testRunner.setWindowIsKey(false);
+}
+if (window.testRunner)
+ window.jsTestIsAsync = true;
+</script>
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/fast/forms/text/text-window-lost-focus-change-event-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698