Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /editing/other/copy-paste-in-styled-inline-editing-host.https.html - WPT Dashboard Interop Dashboard
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="timeout" content="long">
<title>Copying text in styled inline editing host should not duplicate the editing host</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("DOMContentLoaded", () => {
promise_test(async () => {
const editingHost = document.querySelector("span[contenteditable]");
editingHost.focus();
await test_driver.click(editingHost);
const utils = new EditorTestUtils(editingHost);
utils.setupEditingHost("ABC [DEF ]GHI");
await utils.sendCopyShortcutKey();
getSelection().collapse(editingHost.firstChild, editingHost.firstChild.length);
await utils.sendPasteShortcutKey();
assert_equals(
editingHost.innerHTML.replace(" ", " "),
"ABC DEF GHIDEF "
);
}, `Copying text in styled inline editing host should not duplicate the editing host`);
}, {once: true});
</script>
</head>
<body>
<span contenteditable style="font-size:2em;font-weight:bold;border:1px solid">ABC</span><br>
</body>
</html>