Skip to content

Commit 9137a9b

Browse files
committed
Add workaround for jsdom missing HTMLDialogElement support
1 parent d3c8839 commit 9137a9b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

configs/mocha-config-compass/register/jsdom-extra-mocks-register.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,21 @@ Object.assign(tabbable, {
3535
origTabbable.isTabbable(node, { ...options, displayCheck: 'none' }),
3636
});
3737

38+
// Workaround for missing HTMLDialogElement in jsdom
39+
// See https://github.com/jsdom/jsdom/issues/3294
40+
41+
Object.assign(HTMLDialogElement.prototype, {
42+
show() {
43+
this.open = true;
44+
},
45+
showModal() {
46+
this.open = true;
47+
},
48+
close() {
49+
this.open = false;
50+
},
51+
});
52+
3853
// leafygreen (through `clipboard` library) uses deprecated API check that is
3954
// not working in jsdom if copy / paste APIs are supported
4055
if (!window.document.queryCommandSupported) {

0 commit comments

Comments
 (0)