зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1327798 - Part 2. Add test. r=enndeakin
MozReview-Commit-ID: 2B2mVNgcBEz --HG-- extra : rebase_source : 994d68282b51289b61dd1cc1ea39711cb21acb00
This commit is contained in:
Родитель
2dcf7753c2
Коммит
a4109eb8fa
|
@ -139,6 +139,8 @@ support-files = bug1017086_inner.html
|
|||
[test_bug1248459.html]
|
||||
[test_bug1264380.html]
|
||||
run-if = (e10s && os != "win") # Bug 1270043, crash at windows platforms; Bug1264380 comment 20, nsDragService::InvokeDragSessionImpl behaves differently among platform implementations in non-e10s mode which prevents us to check the validity of nsIDragService::getCurrentSession() consistently via synthesize mouse clicks in non-e10s mode.
|
||||
[test_bug1327798.html]
|
||||
subsuite = clipboard
|
||||
[test_clickevent_on_input.html]
|
||||
skip-if = toolkit == 'android' #CRASH_DUMP, RANDOM
|
||||
[test_continuous_wheel_events.html]
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for bug 1327798</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" 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/unicode data ?
|
||||
ok(clipboard.hasDataMatchingFlavors(["text/unicode"], 1, clipboard.kGlobalClipboard),
|
||||
"clipboard contains unicode text");
|
||||
// does the clipboard contain text/html data ?
|
||||
ok(clipboard.hasDataMatchingFlavors(["text/html"], 1, clipboard.kGlobalClipboard),
|
||||
"clipboard contains html text");
|
||||
|
||||
window.addEventListener("paste", (e) => {
|
||||
ok(e.clipboardData.types.indexOf('text/html'), -1, "clipboardData shouldn't have text/html");
|
||||
ok(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>
|
Загрузка…
Ссылка в новой задаче