Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
/* Any copyright is dedicated to the Public Domain.
"use strict";
// autocompletion.
const TEST_URI =
"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);
});