From d3d6dda2dd80fa4c263794a8ec613ff23a8aca0f Mon Sep 17 00:00:00 2001 From: Mason Freed Date: Tue, 10 Dec 2024 17:04:15 +0000 Subject: [PATCH] Bug 1936066 [wpt PR 49592] - Remove exception from requestClose, a=testonly Automatic update from web-platform-tests Remove exception from requestClose See this conversation: https://github.com/whatwg/html/pull/10737/files#r1873864137 There doesn't seem to be a reason to require `closedby` to be used in order for `requestClose()` to work. Bug: 376516550 Change-Id: I1d942ccafec9c30bad1bc6c4b3dfbb3f7782750b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6077771 Commit-Queue: David Baron Auto-Submit: Mason Freed Reviewed-by: David Baron Cr-Commit-Position: refs/heads/main@{#1393736} -- wpt-commits: 9d055431b6064c81efc9102d2af1ddb0355eb588 wpt-pr: 49592 --- .../dialog-requestclose.tentative.html | 39 ++++++------------- 1 file changed, 11 insertions(+), 28 deletions(-) diff --git a/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-requestclose.tentative.html b/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-requestclose.tentative.html index eb2270b861c75..18486f791b4a6 100644 --- a/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-requestclose.tentative.html +++ b/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-requestclose.tentative.html @@ -62,13 +62,8 @@ promise_test(async (t) => { await setup(t,closedby); openDialog(modal); - if (dialog.closedBy != "none") { - dialog.requestClose(); - assert_false(dialog.open); - } else { - assert_throws_dom('InvalidStateError',() => dialog.requestClose()); - assert_true(dialog.open); - } + dialog.requestClose(); + assert_false(dialog.open); },`requestClose basic behavior ${testDescription}`); promise_test(async (t) => { @@ -78,15 +73,11 @@ dialog.addEventListener('close',() => events.push('close'),{signal}); openDialog(modal); assert_array_equals(events,[]); - if (dialog.closedBy != "none") { - dialog.requestClose(); - assert_false(dialog.open); - assert_array_equals(events,['cancel'],'close is scheduled'); - await new Promise(resolve => requestAnimationFrame(resolve)); - assert_array_equals(events,['cancel','close']); - } else { - assert_throws_dom('InvalidStateError',() => dialog.requestClose()); - } + dialog.requestClose(); + assert_false(dialog.open); + assert_array_equals(events,['cancel'],'close is scheduled'); + await new Promise(resolve => requestAnimationFrame(resolve)); + assert_array_equals(events,['cancel','close']); },`requestClose fires both cancel and close ${testDescription}`); promise_test(async (t) => { @@ -97,12 +88,8 @@ openDialog(modal); dialog.setAttribute('closedby',closedby); assert_array_equals(events,[]); - if (dialog.closedBy != "none") { - dialog.requestClose(); - assert_false(dialog.open); - } else { - assert_throws_dom('InvalidStateError',() => dialog.requestClose()); - } + dialog.requestClose(); + assert_false(dialog.open); },`changing closedby from 'none' to '${closedby}' for ${modal ? "modal" : "modeless"} dialog`); promise_test(async (t) => { @@ -113,12 +100,8 @@ openDialog(modal); dialog.removeAttribute('closedby'); assert_array_equals(events,[]); - if (dialog.closedBy != "none") { - dialog.requestClose(); - assert_false(dialog.open); - } else { - assert_throws_dom('InvalidStateError',() => dialog.requestClose()); - } + dialog.requestClose(); + assert_false(dialog.open); },`Removing closedby when closedby='${closedby}' for ${modal ? "modal" : "modeless"} dialog`); if (dialog.closedBy != "none") {