Bug 1788545 - Fix test failure in browser_addressWidgets.js. r=aleca

Differential Revision: https://phabricator.services.mozilla.com/D163526

--HG--
extra : rebase_source : 32cab8525214dd87c1f002f3b5d3a3a0e7795f84
extra : amend_source : d1b2034ae4c5a52aa559c84613c8475ce2c5ffd9
This commit is contained in:
Magnus Melin 2022-12-01 21:31:24 +11:00
Родитель 64c9ac93a4
Коммит d308430082
1 изменённых файлов: 18 добавлений и 9 удалений

Просмотреть файл

@ -275,9 +275,12 @@ add_task(async function test_address_suppress_leading_comma_space() {
input.SelectionEnd = 1;
await TestUtils.waitForTick();
eventPromise = BrowserTestUtils.waitForEvent(input, "keydown");
EventUtils.synthesizeKey(key, {}, controller.window);
await eventPromise;
await BrowserTestUtils.synthesizeKey(
key,
{},
controller.window.browsingContext
);
await new Promise(resolve => requestAnimationFrame(resolve));
Assert.equal(input.value, "z" + key);
@ -297,9 +300,12 @@ add_task(async function test_address_suppress_leading_comma_space() {
await TestUtils.waitForTick();
// Type the key to replace the text.
eventPromise = BrowserTestUtils.waitForEvent(input, "keydown");
EventUtils.synthesizeKey(key, {}, controller.window);
await eventPromise;
await BrowserTestUtils.synthesizeKey(
key,
{},
controller.window.browsingContext
);
await new Promise(resolve => requestAnimationFrame(resolve));
if (key === " " || key === ",") {
// Key is suppressed and input is empty.
@ -323,9 +329,12 @@ add_task(async function test_address_suppress_leading_comma_space() {
input.selectionEnd = 5;
await TestUtils.waitForTick();
eventPromise = BrowserTestUtils.waitForEvent(input, "keydown");
EventUtils.synthesizeKey(key, {}, controller.window);
await eventPromise;
await BrowserTestUtils.synthesizeKey(
key,
{},
controller.window.browsingContext
);
await new Promise(resolve => requestAnimationFrame(resolve));
Assert.equal(input.value, " " + key + "t ");
}
}