Skip to content

Commit

Permalink
Add optional force parameter to togglePopover
Browse files Browse the repository at this point in the history
This was suggested by domenic here:
whatwg/html#8221 (comment)

Bug: 1307772
Change-Id: Ie371028dd41601f445b7590d0769e6bf101f6072
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4070786
Commit-Queue: Mason Freed <[email protected]>
Reviewed-by: Mason Freed <[email protected]>
Commit-Queue: Joey Arhar <[email protected]>
Auto-Submit: Joey Arhar <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1081666}
  • Loading branch information
josepharhar authored and chromium-wpt-export-bot committed Dec 9, 2022
1 parent e0177c5 commit 574f5c5
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@
assertPopoverVisibility(popover, /*isPopover*/true, /*expectedVisibility*/true, 'After togglePopover() on hidden popover, it should be visible');
popover.togglePopover();
assertPopoverVisibility(popover, /*isPopover*/true, /*expectedVisibility*/false, 'After togglePopover() on visible popover, it should be hidden');
popover.togglePopover(/*force=*/true);
assertPopoverVisibility(popover, /*isPopover*/true, /*expectedVisibility*/true, 'After togglePopover(true) on hidden popover, it should be visible');
popover.togglePopover(/*force=*/true);
assertPopoverVisibility(popover, /*isPopover*/true, /*expectedVisibility*/true, 'After togglePopover(true) on visible popover, it should be visible');
popover.togglePopover(/*force=*/false);
assertPopoverVisibility(popover, /*isPopover*/true, /*expectedVisibility*/false, 'After togglePopover(false) on visible popover, it should be hidden');
popover.togglePopover(/*force=*/false);
assertPopoverVisibility(popover, /*isPopover*/true, /*expectedVisibility*/false, 'After togglePopover(false) on hidden popover, it should be hidden');
const parent = popover.parentElement;
popover.remove();
assert_throws_dom("InvalidStateError",() => popover.showPopover(),'Calling showPopover on a disconnected popover should throw InvalidStateError');
Expand Down

0 comments on commit 574f5c5

Please sign in to comment.