summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/shadow-dom/selection-direction.tentative.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/shadow-dom/selection-direction.tentative.html')
-rw-r--r--testing/web-platform/tests/shadow-dom/selection-direction.tentative.html42
1 files changed, 42 insertions, 0 deletions
diff --git a/testing/web-platform/tests/shadow-dom/selection-direction.tentative.html b/testing/web-platform/tests/shadow-dom/selection-direction.tentative.html
index 3a2512dcc7..b5b3f6044c 100644
--- a/testing/web-platform/tests/shadow-dom/selection-direction.tentative.html
+++ b/testing/web-platform/tests/shadow-dom/selection-direction.tentative.html
@@ -6,6 +6,9 @@
<link rel="help" href="https://w3c.github.io/selection-api/#dom-selection-getcomposedrange">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
+<script src="/resources/testdriver.js"></script>
+<script src="/resources/testdriver-actions.js"></script>
+<script src='/resources/testdriver-vendor.js'></script>
<div id="container"></div>
<script>
@@ -58,6 +61,45 @@ test(() => {
assert_equals(getSelection().direction, 'backward');
}, 'direction returns "backward" when there is a forward selection that crosses shadow boundaries');
+promise_test(async () => {
+ container.innerHTML = 'hello, world';
+ const doubleClick = new test_driver.Actions()
+ .pointerMove(0, 0, container.firstChild)
+ .pointerDown()
+ .pointerUp()
+ .pointerDown()
+ .pointerUp()
+ .send();
+ await doubleClick;
+
+ const sel = getSelection();
+ assert_equals(sel.anchorNode, container.firstChild);
+ assert_equals(sel.anchorOffset, 0);
+ assert_equals(sel.focusNode, container.firstChild);
+ assert_equals(sel.focusOffset, 5); // hello
+ assert_equals(sel.direction, 'none');
+}, 'direction returns "none" when there is a double click selection(directionless)');
+
+promise_test(async () => {
+ container.innerHTML = 'hello, world';
+ const tripleClick = new test_driver.Actions()
+ .pointerMove(0, 0, container.firstChild)
+ .pointerDown()
+ .pointerUp()
+ .pointerDown()
+ .pointerUp()
+ .pointerDown()
+ .pointerUp()
+ .send();
+ await tripleClick;
+
+ const sel = getSelection();
+ assert_equals(sel.anchorNode, container);
+ assert_equals(sel.anchorOffset, 0);
+ assert_equals(sel.focusNode, container);
+ assert_equals(sel.focusOffset, 1);
+ assert_equals(sel.direction, 'none');
+}, 'direction returns "none" when there is a triple click selection(directionless)');
</script>
</body>
</html>