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

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: Using setFocus instead of dispatchChange mechanism 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
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..29b3e24e63b189d4fe6b50cd8b4270a5310a8636
--- /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'/>
tkent 2014/03/31 07:40:22 The quotation marks should be " for consistency wi
Habib Virji 2014/03/31 09:30:15 Done.
+<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() {
tkent 2014/03/31 07:40:22 should remove extra space after ,
Habib Virji 2014/03/31 09:30:15 Done.
+ blurEventCounter++;
+ shouldEvaluateTo('blurEventCounter', 1);
tkent 2014/03/31 07:40:22 extra space after ,
Habib Virji 2014/03/31 09:30:15 Done.
+ shouldEvaluateTo('changeEventCounter', 1);
+ finishJSTest();
+ });
+ text.focus();
+ document.execCommand("InsertText", false, "hello world");
tkent 2014/03/31 07:40:22 The quotation marks should be ' for consistency wi
Habib Virji 2014/03/31 09:30:15 Done.
+ shouldEvaluateTo('blurEventCounter', 0);
tkent 2014/03/31 07:40:22 extra space after ,
Habib Virji 2014/03/31 09:30:15 Done.
+ shouldEvaluateTo('changeEventCounter', 0);
+ window.testRunner.setMainFrameIsFirstResponder(true);
+ window.testRunner.setWindowIsKey(false);
+}
+if (window.testRunner)
+ window.jsTestIsAsync = true;
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698