| 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>
|
|
|