36 lines
No EOL
1.6 KiB
HTML
36 lines
No EOL
1.6 KiB
HTML
<!doctype html>
|
|
<meta charset=utf-8>
|
|
<title>This test is for testing HTML text copy paste of anchor tag containing href
|
|
inside contenteditable.</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>
|
|
<div contenteditable="true" id="contentCopy"><a href="www.crbug.com/356548150">AnchorTagWithHREF</a></div>
|
|
<div contenteditable="true" id="contentPaste"></div>
|
|
<script>
|
|
document.addEventListener("DOMContentLoaded", () => {
|
|
promise_test(async () => {
|
|
const range = document.createRange();
|
|
const contentToCopy = document.getElementById("contentCopy");
|
|
range.selectNodeContents(contentToCopy);
|
|
const selection = window.getSelection();
|
|
const anchorToCopy = contentToCopy.querySelector("a");
|
|
selection.removeAllRanges();
|
|
selection.addRange(range);
|
|
|
|
// Send copy command
|
|
const utils = new EditorTestUtils(anchorToCopy);
|
|
await utils.sendCopyShortcutKey();
|
|
assert_true(anchorToCopy.hasAttribute("href"));
|
|
|
|
const pasteTarget = document.getElementById("contentPaste");
|
|
pasteTarget.focus();
|
|
await utils.sendPasteShortcutKey();
|
|
const pastedAnchor = pasteTarget.querySelector("a");
|
|
assert_true(pastedAnchor.hasAttribute("href"));
|
|
}, "Attribute href is missing after copy paste of anchor tag");
|
|
})
|
|
</script> |