diff options
Diffstat (limited to 'testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-no-throw-requested-state.html')
-rw-r--r-- | testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-no-throw-requested-state.html | 29 |
1 files changed, 29 insertions, 0 deletions
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 0000000000..c86cbe84a6 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-no-throw-requested-state.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<link rel=author href="mailto:jarhar@chromium.org"> +<link rel=help href="https://github.com/whatwg/html/pull/9142"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<dialog>hello</dialog> + +<script> +test(() => { + const dialog = document.querySelector('dialog'); + + // calling close() on a dialog that is already closed should not throw. + dialog.close(); + + dialog.show(); + // calling show() on a dialog that is already showing non-modal should not throw. + dialog.show(); + assert_throws_dom('InvalidStateError', () => dialog.showModal(), + 'Calling showModal() on a dialog that is already showing non-modal should throw.'); + dialog.close(); + + dialog.showModal(); + assert_throws_dom('InvalidStateError', () => dialog.show(), + 'Calling show() on a dialog that is already showing modal should throw.'); + // calling showModal() on a dialog that is already showing modal should not throw. + dialog.showModal(); +}); +</script> |