summaryrefslogtreecommitdiffstats
path: root/editor/libeditor/tests/test_pasting_in_temporarily_created_div_outside_body.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /editor/libeditor/tests/test_pasting_in_temporarily_created_div_outside_body.html
parentInitial commit. (diff)
downloadthunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz
thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--editor/libeditor/tests/test_pasting_in_temporarily_created_div_outside_body.html42
1 files changed, 42 insertions, 0 deletions
diff --git a/editor/libeditor/tests/test_pasting_in_temporarily_created_div_outside_body.html b/editor/libeditor/tests/test_pasting_in_temporarily_created_div_outside_body.html
new file mode 100644
index 0000000000..05250be049
--- /dev/null
+++ b/editor/libeditor/tests/test_pasting_in_temporarily_created_div_outside_body.html
@@ -0,0 +1,42 @@
+<!doctype html>
+<html>
+<head>
+<title>Test for paste in temporarily created div element outside the body element</title>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script src="/tests/SimpleTest/EventUtils.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+<script>
+SimpleTest.waitForExplicitFinish();
+SimpleTest.waitForFocus(async () => {
+ const editor = document.querySelector("div[contenteditable]");
+ const heading = document.querySelector("h1");
+ getSelection().setBaseAndExtent(heading.firstChild, "So".length,
+ heading.firstChild, "Some te".length);
+ try {
+ await SimpleTest.promiseClipboardChange(
+ "me te", () => synthesizeKey("c", {accelKey: true}));
+ } catch (ex) {
+ ok(false, `Failed to copy selected text: ${ex}`);
+ SimpleTest.finish();
+ }
+ editor.focus();
+ editor.addEventListener("paste", () => {
+ const anotherEditor = document.createElement("div");
+ anotherEditor.setAttribute("contenteditable", "true");
+ document.documentElement.appendChild(anotherEditor);
+ anotherEditor.focus();
+ }, {once: true});
+ synthesizeKey("v", {accelKey: true});
+ const tempEditor = document.documentElement.lastChild;
+ is(tempEditor.nodeName.toLocaleLowerCase(), "div",
+ "Paste event handler should've inserted another editor");
+ is(tempEditor.textContent.trim(), "me te");
+ SimpleTest.finish();
+});
+</script>
+</head>
+<body>
+ <h1>Some text</h1>
+ <div contenteditable></div>
+</body>
+</html>