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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script src = "../../../resources/js-test.js"> </script>
4 </head>
5 <body onload="runTest()">
6 <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.
7 <script>
8
9 var blurEventCounter = 0;
10 var changeEventCounter = 0;
11
12 function runTest() {
13 description('Test when window out of focus, should dispatch both blur and ch ange event');
14 var text = document.getElementById('text');
15 text.addEventListener('change', function() {
16 changeEventCounter++;
17 });
18 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.
19 blurEventCounter++;
20 shouldEvaluateTo('blurEventCounter', 1);
tkent 2014/03/31 07:40:22 extra space after ,
Habib Virji 2014/03/31 09:30:15 Done.
21 shouldEvaluateTo('changeEventCounter', 1);
22 finishJSTest();
23 });
24 text.focus();
25 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.
26 shouldEvaluateTo('blurEventCounter', 0);
tkent 2014/03/31 07:40:22 extra space after ,
Habib Virji 2014/03/31 09:30:15 Done.
27 shouldEvaluateTo('changeEventCounter', 0);
28 window.testRunner.setMainFrameIsFirstResponder(true);
29 window.testRunner.setWindowIsKey(false);
30 }
31 if (window.testRunner)
32 window.jsTestIsAsync = true;
33 </script>
34 </body>
35 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698