blob: df574f06cfa12916ae213e866b66228d7adf0e18 (
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
/* 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/. */
// Tests showing and hiding the reverse search UI.
"use strict";
const TEST_URI = `data:text/html,<!DOCTYPE html><meta charset=utf8>Test reverse search toggle`;
const isMacOS = AppConstants.platform === "macosx";
add_task(async function () {
const hud = await openNewTabAndConsole(TEST_URI);
info("Close the reverse search UI with ESC");
await openReverseSearch(hud);
let onReverseSearchUiClose = waitFor(
() => getReverseSearchElement(hud) === null
);
EventUtils.sendKey("ESCAPE");
await onReverseSearchUiClose;
ok(true, "Reverse search was closed with the Esc keyboard shortcut");
if (isMacOS) {
info("Close the reverse search UI with Ctrl + C on OSX");
await openReverseSearch(hud);
onReverseSearchUiClose = waitFor(
() => getReverseSearchElement(hud) === null
);
EventUtils.synthesizeKey("c", { ctrlKey: true });
await onReverseSearchUiClose;
ok(true, "Reverse search was closed with the Ctrl + C keyboard shortcut");
}
info("Close the reverse search UI with the close button");
const reverseSearchElement = await openReverseSearch(hud);
const closeButton = reverseSearchElement.querySelector(
".reverse-search-close-button"
);
ok(closeButton, "The close button is displayed");
is(
closeButton.title,
`Close (Esc${isMacOS ? " | Ctrl + C" : ""})`,
"The close button has the expected tooltip"
);
onReverseSearchUiClose = waitFor(() => getReverseSearchElement(hud) === null);
closeButton.click();
await onReverseSearchUiClose;
ok(true, "Reverse search was closed by clicking on the close button");
info("Close the reverse search UI by clicking on the output");
await openReverseSearch(hud);
hud.ui.outputNode.querySelector(".jsterm-input-container").click();
ok(true, "Reverse search was closed by clicking in the output");
});
|