diff --git a/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-no-throw-requested-state.html b/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-no-throw-requested-state.html new file mode 100644 index 0000000000000..c86cbe84a6229 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-no-throw-requested-state.html @@ -0,0 +1,29 @@ + + + + + + +hello + + diff --git a/testing/web-platform/tests/html/semantics/popovers/popover-attribute-basic.html b/testing/web-platform/tests/html/semantics/popovers/popover-attribute-basic.html index eab61407c8b38..32d3deb3848c2 100644 --- a/testing/web-platform/tests/html/semantics/popovers/popover-attribute-basic.html +++ b/testing/web-platform/tests/html/semantics/popovers/popover-attribute-basic.html @@ -254,11 +254,21 @@ },{once: true}); assert_true(popover.matches(':popover-open')); assert_true(other_popover.matches(':popover-open')); - assert_throws_dom('InvalidStateError', () => popover.hidePopover()); + popover.hidePopover(); // Calling hidePopover on a hidden popover should not throw. assert_false(other_popover.matches(':popover-open'),'unrelated popover is hidden'); assert_false(popover.matches(':popover-open'),'popover is still hidden if its type changed during hide event'); - assert_throws_dom("InvalidStateError",() => other_popover.hidePopover(),'Nested popover should already be hidden'); - },`Changing the popover type in a "beforetoggle" event handler should throw an exception (during hidePopover())`); + other_popover.hidePopover(); // Calling hidePopover on a hidden popover should not throw. + },`Changing the popover type in a "beforetoggle" event handler during hidePopover() should not throw an exception`); + + test(t => { + const popover = document.createElement('div'); + assert_throws_dom('NotSupportedError', () => popover.hidePopover(), + 'Calling hidePopover on an element without a popover attribute should throw.'); + popover.setAttribute('popover', 'auto'); + popover.hidePopover(); // Calling hidePopover on a disconnected popover should not throw. + assert_throws_dom('InvalidStateError', () => popover.showPopover(), + 'Calling showPopover on a disconnected popover should throw.'); + },'Calling hidePopover on a disconnected popover should not throw.'); function interpretedType(typeString,method) { if (validTypes.includes(typeString)) diff --git a/testing/web-platform/tests/html/semantics/popovers/popover-light-dismiss.html b/testing/web-platform/tests/html/semantics/popovers/popover-light-dismiss.html index d7d1edd3a4b1f..4b888169e1bec 100644 --- a/testing/web-platform/tests/html/semantics/popovers/popover-light-dismiss.html +++ b/testing/web-platform/tests/html/semantics/popovers/popover-light-dismiss.html @@ -532,7 +532,7 @@ p14.hidePopover(); },{once:true}); assert_true(p13.matches(':popover-open') && p14.matches(':popover-open') && p15.matches(':popover-open'),'all three should be open'); - assert_throws_dom('InvalidStateError',() => p14.hidePopover(),'should throw because the event listener has already hidden the popover'); + p14.hidePopover(); assert_true(p13.matches(':popover-open'),'p13 should still be open'); assert_false(p14.matches(':popover-open')); assert_false(p15.matches(':popover-open')); @@ -579,10 +579,7 @@ p20.showPopover(); }); p20.addEventListener('beforetoggle', logEvents); - // Because the `beforetoggle` handler shows a different popover, - // and that action closes the p19 popover, the call to hidePopover() - // will result in an exception. - assert_throws_dom('InvalidStateError',() => p19.hidePopover()); + p19.hidePopover(); assert_array_equals(events,['hide p19','show p20'],'There should not be a second hide event for 19'); assert_false(p19.matches(':popover-open')); assert_true(p20.matches(':popover-open')); diff --git a/testing/web-platform/tests/html/semantics/popovers/popover-move-documents.html b/testing/web-platform/tests/html/semantics/popovers/popover-move-documents.html index 9feaa4b2bf875..11f52c2f2f0d1 100644 --- a/testing/web-platform/tests/html/semantics/popovers/popover-move-documents.html +++ b/testing/web-platform/tests/html/semantics/popovers/popover-move-documents.html @@ -4,10 +4,30 @@ + +
p1