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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/events/space-scroll-textinput-canceled.html

Issue 1671103002: Prevent remaining keypress actions if textInput was canceled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added layout test Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/events/space-scroll-textinput-canceled-expected.txt » ('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 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 <style type="text/css">
6 ::-webkit-scrollbar {
7 width: 0px;
8 height: 0px;
9 }
10 </style>
11 </head>
12 <body style="margin:0" onload="runTest();">
13 <p>
14 Tests that page shouldn't scroll when you hit space key on input field
15 and 'textInput' event was canceled.
16 </p>
17 <div id="console"></div>
18
19 <input type="text" id="txt" />
20 <div style="height: 2000px;"></div>
21
22 <script type="text/javascript">
23 var txt = document.getElementById('txt');
24 txt.addEventListener('textInput', function(e) {
25 if (e.data === ' ') {
26 e.preventDefault();
27 }
28 }, false);
29
30 var scrolled = false;
31 document.addEventListener('scroll', function(e) {scrolled = true;}, false);
32
33 function focusAndPressSpace()
34 {
35 document.getElementById('txt').focus();
36 eventSender.keyDown(" ", []);
37 // Wait for scroll
38 setTimeout(function() {
39 shouldBeFalse('scrolled');
40 finishJSTest();
41 }, 10);
dtapuska 2016/02/08 13:50:07 Is this reliable? Should we instead register for a
42 }
43
44 jsTestIsAsync = true;
45
46 function runTest()
47 {
48 if (window.eventSender) {
49 focusAndPressSpace();
50 }
51 }
52 </script>
53
54 </body>
55 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/events/space-scroll-textinput-canceled-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698