summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/editing/other/delete-in-inline-editing-host-under-shadow-root.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/editing/other/delete-in-inline-editing-host-under-shadow-root.html')
-rw-r--r--testing/web-platform/tests/editing/other/delete-in-inline-editing-host-under-shadow-root.html61
1 files changed, 61 insertions, 0 deletions
diff --git a/testing/web-platform/tests/editing/other/delete-in-inline-editing-host-under-shadow-root.html b/testing/web-platform/tests/editing/other/delete-in-inline-editing-host-under-shadow-root.html
new file mode 100644
index 0000000000..c1a825a645
--- /dev/null
+++ b/testing/web-platform/tests/editing/other/delete-in-inline-editing-host-under-shadow-root.html
@@ -0,0 +1,61 @@
+<!doctype html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Backspace/Delete in inline editing host which is a shadow root</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resources/testdriver.js"></script>
+<script src="/resources/testdriver-vendor.js"></script>
+<script src="/resources/testdriver-actions.js"></script>
+<script src="../include/editor-test-utils.js"></script>
+<script>
+"use strict";
+
+addEventListener("load", () => {
+ const shadowRoot = document.body.firstChild.attachShadow({mode: "open"});
+ const editingHost = document.createElement("span");
+ editingHost.setAttribute("contenteditable", "");
+ shadowRoot.appendChild(editingHost);
+ const utils = new EditorTestUtils(editingHost);
+
+ promise_test(async t => {
+ utils.setupEditingHost("ab[]c");
+ await utils.sendBackspaceKey();
+ assert_equals(
+ editingHost.textContent,
+ "ac"
+ );
+ }, "Backspace at <span contenteditable>ab[]c</span>");
+
+ promise_test(async t => {
+ utils.setupEditingHost("a[]bc");
+ await utils.sendDeleteKey();
+ assert_equals(
+ editingHost.textContent,
+ "ac"
+ );
+ }, "Delete at <span contenteditable>a[]bc</span>");
+
+ promise_test(async t => {
+ utils.setupEditingHost("a[b]c");
+ await utils.sendBackspaceKey();
+ assert_equals(
+ editingHost.textContent,
+ "ac"
+ );
+ }, "Backspace at <span contenteditable>a[b]c</span>");
+
+ promise_test(async t => {
+ utils.setupEditingHost("a[b]c");
+ await utils.sendDeleteKey();
+ assert_equals(
+ editingHost.textContent,
+ "ac"
+ );
+ }, "Delete at <span contenteditable>a[b]c</span>");
+}, {once: true});
+</script>
+</head>
+<body><div></div></body>
+</html>