| Index: LayoutTests/fast/events/touch/gesture/gesture-tap-setrangetext-with-events.html
|
| diff --git a/LayoutTests/fast/events/touch/gesture/gesture-tap-setrangetext-with-events.html b/LayoutTests/fast/events/touch/gesture/gesture-tap-setrangetext-with-events.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..1495a7399d6c630fc3ac2898b3d4c52113c9e91b
|
| --- /dev/null
|
| +++ b/LayoutTests/fast/events/touch/gesture/gesture-tap-setrangetext-with-events.html
|
| @@ -0,0 +1,45 @@
|
| +<!DOCTYPE html>
|
| +<script src="../../../../resources/testharness.js"></script>
|
| +<script src="../../../../resources/testharnessreport.js"></script>
|
| +<input type="text" value="value" id="textfield"></input>
|
| +<script>
|
| +async_test(function(t) {
|
| + window.onload = t.step_func(function() {
|
| + if (!window.eventSender) {
|
| + t.done();
|
| + return;
|
| + }
|
| + doSetSelectionRange('focus');
|
| + doSetSelectionRange('mousedown');
|
| + doSetSelectionRange('mouseup');
|
| + doSetSelectionRange('click');
|
| + t.done();
|
| + });
|
| +
|
| + function doSetSelectionRange(eventType) {
|
| + var textfield = document.getElementById('textfield');
|
| + textfield.setSelectionRange(0, 0);
|
| + var tx = textfield.offsetLeft + 4;
|
| + var ty = textfield.offsetTop + 4;
|
| +
|
| + textfield.addEventListener(eventType, setSelectionRange);
|
| + eventSender.gestureTapDown(tx, ty);
|
| + eventSender.gestureShowPress(tx, ty);
|
| + eventSender.gestureTap(tx, ty);
|
| + if (eventType === 'mousedown') {
|
| + assert_equals(textfield.selectionStart, 0);
|
| + assert_equals(textfield.selectionEnd, 0);
|
| + } else {
|
| + assert_equals(textfield.selectionStart, 0);
|
| + assert_equals(textfield.selectionEnd, 5);
|
| + }
|
| + textfield.setSelectionRange(0, 0);
|
| + textfield.removeEventListener(eventType, setSelectionRange);
|
| + }
|
| +
|
| + function setSelectionRange(e) {
|
| + var textfield = document.getElementById('textfield');
|
| + textfield.setSelectionRange(0, textfield.value.length);
|
| + }
|
| +}, "This tests the selection of the text field after setSelectionRange is called during a tap.");
|
| +</script>
|
|
|