summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/editing/other/editable-state-and-focus-in-assigned-slot-dom.tentative.html
blob: ae8b14528320f9379855183b23fb56d39730cdc2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Testing editable state and focus in slotted editable element</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="host">
<div contenteditable></div>
</div>
<script>
const text = 'A';
test(() => {
  const host = document.querySelector('#host');
  const shadowRoot = host.attachShadow({ mode: "open" });
  const slot = document.createElement("slot");
  shadowRoot.appendChild(slot);
  const editable = document.querySelector('div[contenteditable]');
  editable.focus();
  document.execCommand('insertText', false, text);
  editable.blur();
  assert_equals(editable.innerText, text);
  editable.focus();
  document.execCommand('insertText', false, text);
  assert_equals(editable.innerText, text + text);
});
</script>
</body>
</html>