Bug 1677263 - Add a test for select event being async r=masayuki

The asynchronous behavior is introduced by using SetSelectionRange inside Select(). This adds a test for that.

Differential Revision: https://phabricator.services.mozilla.com/D98186
This commit is contained in:
Kagami Sascha Rosylight 2020-12-03 02:27:01 +00:00
Родитель aa1ea75c3a
Коммит 954d954d28
2 изменённых файлов: 12 добавлений и 1 удалений

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

@ -433,7 +433,7 @@ function startTest()
expectFocusShift(() => t19.select(),
null, getById("t" + 19), true, "input.select()");
t19.removeEventListener("select", selectListener, false);
ok(selectFired, "select event fires for input");
ok(!selectFired, "select event does not fire asynchronously for input");
// mouse clicking
gLastFocusMethod = fm.FLAG_BYMOUSE;

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

@ -92,6 +92,17 @@ els.forEach((el) => {
// step_wait properly timeouts before the whole test collapses
await t.step_wait(() => !element.onselect, "event didn't fire", 200, 10);
}, `${elLabel}: ${action.label} disconnected node`);
// Intentionally still using promise_test, as assert_unreachable does not
// make the test fail inside a listener while t.unreached_func() does.
promise_test(async t => {
const element = el.cloneNode(true);
const listener = t.unreached_func("the select event must not fire synchronously");
element.onselect = listener;
action.action(element);
element.onselect = null;
}, `${elLabel}: ${action.label} event queue`);
});
});
</script>