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

Unified Diff: LayoutTests/fast/events/touch/gesture/gesture-tap-result.html

Issue 267313008: First-cut at fixing unhandled Tap event returns in Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed handlers for all events other than mousedown. Created 6 years, 7 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 | LayoutTests/fast/events/touch/gesture/gesture-tap-result-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/events/touch/gesture/gesture-tap-result.html
diff --git a/LayoutTests/fast/events/touch/gesture/gesture-tap-result.html b/LayoutTests/fast/events/touch/gesture/gesture-tap-result.html
new file mode 100644
index 0000000000000000000000000000000000000000..326fab20adfdbb78c57a911249776aa50094f449
--- /dev/null
+++ b/LayoutTests/fast/events/touch/gesture/gesture-tap-result.html
@@ -0,0 +1,60 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../../../resources/js-test.js"></script>
+</head>
+<body onload="runTest();">
+
+<input id="input" type="text" value="editable text"><br>
+<span id="plain">This is plain text with no handler</span><br>
+<span id="consumes">This text consumes events using preventDefault()</span><br><br>
+Clicking or tapping on the "consumes" section should have no effect on the selection,
+but clicking in the plain section should clear it.
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+var plainResult = null;
+var consumesResult = null;
+
+function plainCallback() {
+}
+
+function consumeCallback(event) {
+ event.preventDefault();
+}
+
+function runTest() {
+ document.getElementById('input').select();
+ var consumes = document.getElementById('consumes');
+ consumes.addEventListener("mousedown", consumeCallback, false);
+ var plain = document.getElementById('plain');
+ plain.addEventListener("mousedown", plainCallback, false);
+
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ }
+
+ if (window.eventSender) {
+ description("This tests Tap events being consumed by a handler.");
+
+ // A 'tap' gesture event should generate a sequence of mouse events,
+ // which do not affect the selection when consumed.
+ var consumesRect = document.getElementById('consumes').getBoundingClientRect();
+ consumesResult = eventSender.gestureTap(consumesRect.left, consumesRect.top);
+ shouldBe('consumesResult', 'true');
+ shouldNotBe('window.getSelection().toString()', '');
+
+ // Tapping on plain text does not consume the event, and clears the selection.
+ var plainRect = document.getElementById('plain').getBoundingClientRect();
+ plainResult = eventSender.gestureTap(plainRect.left, plainRect.top);
+ shouldBe('plainResult', 'false');
+ shouldBeEmptyString('window.getSelection().toString()');
+ } else {
+ debug("This test requires DumpRenderTree. Tap on the text to log.")
+ }
+}
+</script>
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/fast/events/touch/gesture/gesture-tap-result-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698