blob: 5316d8904c5471c5100376631a4c6fd1832acd41 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* Test link previews.
*/
var { close_compose_window, open_compose_new_mail } = ChromeUtils.import(
"resource://testing-common/mozmill/ComposeHelpers.jsm"
);
var url =
"http://mochi.test:8888/browser/comm/mail/test/browser/composition/html/linkpreview.html";
add_task(async function previewEnabled() {
Services.prefs.setBoolPref("mail.compose.add_link_preview", true);
let controller = open_compose_new_mail();
await navigator.clipboard.writeText(url);
let messageEditor =
controller.window.document.getElementById("messageEditor");
messageEditor.focus();
// Ctrl+V = Paste
EventUtils.synthesizeKey(
"v",
{ shiftKey: false, accelKey: true },
controller.window
);
await TestUtils.waitForCondition(
() => messageEditor.contentDocument.body.querySelector(".moz-card"),
"link preview should have appeared"
);
close_compose_window(controller);
Services.prefs.clearUserPref("mail.compose.add_link_preview");
});
|