Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[popover] Reset state in some subtests (web-platform-tests#39304)
Browse files Browse the repository at this point in the history
For some subtests failure to close the popover (due to some exception/assert failure)
would result in the next subtest to start in an environment that
is not reset to a clean state, so add some cleanup handlers.
rwlbuis authored and cookiecrook committed Apr 8, 2023
1 parent b9a5daf commit 164d11e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions html/semantics/popovers/popover-light-dismiss.html
Original file line number Diff line number Diff line change
@@ -117,7 +117,8 @@
assert_false(popover1.matches(':open'),'pointerup (outside the popover) should trigger light dismiss');
},'Popovers close on pointerup, not pointerdown');

promise_test(async () => {
promise_test(async (t) => {
t.add_cleanup(() => popover1.hidePopover());
assert_false(popover1.matches(':open'));
popover1.showPopover();
assert_true(popover1.matches(':open'));
@@ -132,17 +133,16 @@
await testOne('pointerdown');
await testOne('mouseup');
await testOne('mousedown');
popover1.hidePopover();
},'Synthetic events can\'t close popovers');

promise_test(async () => {
promise_test(async (t) => {
t.add_cleanup(() => popover1.hidePopover());
popover1.showPopover();
await clickOn(inside1After);
assert_true(popover1.matches(':open'));
await sendTab();
assert_equals(document.activeElement,afterp1,'Focus should move to a button outside the popover');
assert_true(popover1.matches(':open'));
popover1.hidePopover();
},'Moving focus outside the popover should not dismiss the popover');

promise_test(async () => {

0 comments on commit 164d11e

Please sign in to comment.