diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/events/test/test_bug1327798.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | dom/events/test/test_bug1327798.html | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/dom/events/test/test_bug1327798.html b/dom/events/test/test_bug1327798.html new file mode 100644 index 0000000000..ac903654f1 --- /dev/null +++ b/dom/events/test/test_bug1327798.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<html> +<head> +<title>Test for bug 1327798</title> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<script src="/tests/SimpleTest/EventUtils.js"></script> +<link rel="stylesheet" href="/tests/SimpleTest/test.css"> +</head> +<body> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?=id=1327798">Mozilla Bug 1327798</a> +<p id="display"></p> +<div id="content" style="display: none;"></div> + +<div contenteditable="true" id="editable1"><b>Formatted Text</b><br></div> +<pre> +<script class="testbody" type="application/javascript"> +SimpleTest.waitForExplicitFinish(); +SimpleTest.waitForFocus(() => { + var editable = document.getElementById("editable1"); + editable.focus(); + + window.getSelection().selectAllChildren(editable1); + + SpecialPowers.doCommand(window, "cmd_copy"); + + //--------- now check the content of the clipboard + var clipboard = SpecialPowers.Cc["@mozilla.org/widget/clipboard;1"] + .getService(SpecialPowers.Ci.nsIClipboard); + // does the clipboard contain text/plain data ? + ok(clipboard.hasDataMatchingFlavors(["text/plain"], clipboard.kGlobalClipboard), + "clipboard contains unicode text"); + // does the clipboard contain text/html data ? + ok(clipboard.hasDataMatchingFlavors(["text/html"], clipboard.kGlobalClipboard), + "clipboard contains html text"); + + window.addEventListener("paste", (e) => { + is(e.clipboardData.types.indexOf('text/html'), -1, "clipboardData shouldn't have text/html"); + is(e.clipboardData.getData('text/plain'), "Formatted Text", "getData(text/plain) should return plain text"); + SimpleTest.finish(); + }); + + SpecialPowers.doCommand(window, "cmd_pasteNoFormatting"); +}); +</script> +</pre> +</body> +</html> |