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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/events/space-scroll-textinput-canceled.html
diff --git a/third_party/WebKit/LayoutTests/fast/events/space-scroll-textinput-canceled.html b/third_party/WebKit/LayoutTests/fast/events/space-scroll-textinput-canceled.html
new file mode 100644
index 0000000000000000000000000000000000000000..37479532635e4c13a3cae40414c13fb02748438d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/events/space-scroll-textinput-canceled.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test.js"></script>
+<style type="text/css">
+::-webkit-scrollbar {
+ width: 0px;
+ height: 0px;
+}
+</style>
+</head>
+<body style="margin:0" onload="runTest();">
+<p>
+ Tests that page shouldn't scroll when you hit space key on input field
+ and 'textInput' event was canceled.
+</p>
+<div id="console"></div>
+
+<input type="text" id="txt" />
+<div style="height: 2000px;"></div>
+
+<script type="text/javascript">
+var txt = document.getElementById('txt');
+txt.addEventListener('textInput', function(e) {
+ if (e.data === ' ') {
+ e.preventDefault();
+ }
+}, false);
+
+var scrolled = false;
+document.addEventListener('scroll', function(e) {scrolled = true;}, false);
+
+function focusAndPressSpace()
+{
+ document.getElementById('txt').focus();
+ eventSender.keyDown(" ", []);
+ // Wait for scroll
+ setTimeout(function() {
+ shouldBeFalse('scrolled');
+ finishJSTest();
+ }, 10);
dtapuska 2016/02/08 13:50:07 Is this reliable? Should we instead register for a
+}
+
+jsTestIsAsync = true;
+
+function runTest()
+{
+ if (window.eventSender) {
+ focusAndPressSpace();
+ }
+}
+</script>
+
+</body>
+</html>
« 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