blob: 899cbc6d5b3097d81d9085aef92f209f0bf7a4ea (
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
|
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const FORMULA = "8 * 8";
const RESULT = "64";
add_setup(async function () {
await SpecialPowers.pushPrefEnv({
set: [["browser.urlbar.suggest.calculator", true]],
});
});
add_task(async function test_calculator() {
await UrlbarTestUtils.promiseAutocompleteResultPopup({
window,
value: FORMULA,
});
let result = (await UrlbarTestUtils.waitForAutocompleteResultAt(window, 1))
.result;
Assert.equal(result.type, UrlbarUtils.RESULT_TYPE.DYNAMIC);
Assert.equal(result.payload.input, FORMULA);
Assert.equal(result.payload.value, RESULT);
EventUtils.synthesizeKey("KEY_ArrowDown");
// Ensure the RESULT get written to the clipboard when selected.
await SimpleTest.promiseClipboardChange(RESULT, () => {
EventUtils.synthesizeKey("KEY_Enter");
});
});
|