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
56
57
58
|
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// See Bug 660806. Check that history navigation with the UP/DOWN arrows does not trigger
// autocompletion.
const TEST_URI =
"data:text/html;charset=utf-8,<!DOCTYPE html><p>bug 660806 - history " +
"navigation must not show the autocomplete popup";
add_task(async function () {
const hud = await openNewTabAndConsole(TEST_URI);
const { jsterm } = hud;
const popup = jsterm.autocompletePopup;
// The autocomplete popup should never be displayed during the test.
const onShown = function () {
ok(false, "popup shown");
};
popup.on("popup-opened", onShown);
await executeAndWaitForResultMessage(
hud,
`window.foobarBug660806 = {
'location': 'value0',
'locationbar': 'value1'
}`,
""
);
ok(!popup.isOpen, "popup is not open");
// Let's add this expression in the input history. We don't use setInputValue since
// it _does_ trigger an autocompletion request in codeMirror JsTerm.
await executeAndWaitForResultMessage(
hud,
"window.foobarBug660806.location",
""
);
const onSetInputValue = jsterm.once("set-input-value");
EventUtils.synthesizeKey("KEY_ArrowUp");
await onSetInputValue;
// We don't have an explicit event to wait for here, so we just wait for the next tick
// before checking the popup status.
await new Promise(executeSoon);
is(
getInputValue(hud),
"window.foobarBug660806.location",
"input has expected value"
);
ok(!popup.isOpen, "popup is not open");
popup.off("popup-opened", onShown);
});
|