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

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: Use pageUp+space combination instead of timeout in layouttests 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 function focusAndPressSpace()
31 {
32 document.getElementById('txt').focus();
33 // Leave some space for pageUp
34 document.scrollingElement.scrollTop = window.innerHeight / 2;
35
36 eventSender.keyDown("pageUp", []);
37 // Space key shouldn't cancel pageUp
38 eventSender.keyDown(" ", []);
39
40 // pageUp should finish
41 shouldBecomeEqual("document.scrollingElement.scrollTop", "0", finishJSTest);
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