From 18dd749c3421cf3523119c2647a901271b8c6db2 Mon Sep 17 00:00:00 2001 From: Tim Nguyen Date: Mon, 23 May 2022 10:01:28 +0000 Subject: [PATCH] Bug 1769966 [wpt PR 34107] - Clean up modal dialog tests and split out :modal pseudo-class test, a=testonly Automatic update from web-platform-tests Clean up modal dialog tests and split out :modal pseudo-class test (#34107) Closes https://github.com/web-platform-tests/interop-2022/issues/79 -- wpt-commits: f4e735e4245973ad955ecadab644b71a3d4533df wpt-pr: 34107 --- .../css/selectors/modal-pseudo-class.html | 38 +++++++++++++++++++ .../the-dialog-element/dialog-show-modal.html | 38 ------------------- ...html => dialog-showModal-inert-crash.html} | 0 .../the-dialog-element/dialog-showModal.html | 16 ++++++++ 4 files changed, 54 insertions(+), 38 deletions(-) create mode 100644 testing/web-platform/tests/css/selectors/modal-pseudo-class.html delete mode 100644 testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-show-modal.html rename testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/{dialog-show-modal-inert-crash.html => dialog-showModal-inert-crash.html} (100%) diff --git a/testing/web-platform/tests/css/selectors/modal-pseudo-class.html b/testing/web-platform/tests/css/selectors/modal-pseudo-class.html new file mode 100644 index 0000000000000..94b7b20e6276c --- /dev/null +++ b/testing/web-platform/tests/css/selectors/modal-pseudo-class.html @@ -0,0 +1,38 @@ + + +:modal pseudo-class + + + + + +Just another dialog. + + diff --git a/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-show-modal.html b/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-show-modal.html deleted file mode 100644 index 610e66d20112f..0000000000000 --- a/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-show-modal.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - -It's my dialog. - - diff --git a/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-show-modal-inert-crash.html b/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-showModal-inert-crash.html similarity index 100% rename from testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-show-modal-inert-crash.html rename to testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-showModal-inert-crash.html diff --git a/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-showModal.html b/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-showModal.html index 32f308235eb97..c511631f9fbb7 100644 --- a/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-showModal.html +++ b/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-showModal.html @@ -62,10 +62,12 @@ test(function(){ assert_false(d1.open); assert_false(d1.hasAttribute("open")); + assert_equals(getComputedStyle(d1).display, "none"); d1.showModal(); this.add_cleanup(function() { d1.close(); }); assert_true(d1.open); assert_equals(d1.getAttribute("open"), ""); + assert_equals(getComputedStyle(d1).display, "block"); assert_equals(document.activeElement, b1); }); @@ -169,4 +171,18 @@ d11.close(); assert_equals(topElement(), d10); }, "when opening multiple dialogs, the most recently opened is rendered on top"); + + test(function() { + assert_false(d11.open); + d11.parentNode.removeChild(d11); + assert_throws_dom("INVALID_STATE_ERR", () => d11.showModal()); + + const doc = document.implementation.createHTMLDocument(); + doc.body.appendChild(d11); + this.add_cleanup(() => document.body.append(d11)); + assert_false(d11.open); + d11.showModal(); + assert_true(d11.open); + this.add_cleanup(() => d11.close()); + }, "Although the document is not attached to any pages, showModal() should execute as normal.");