aboutsummaryrefslogtreecommitdiff
path: root/test/jsdom.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/jsdom.test.js')
-rw-r--r--test/jsdom.test.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/test/jsdom.test.js b/test/jsdom.test.js
index c53f374e..6c2e00ee 100644
--- a/test/jsdom.test.js
+++ b/test/jsdom.test.js
@@ -26,20 +26,25 @@ import {expect, test} from 'vitest';
*/
function testJSDOMSelectorBug() {
test('JSDOMSelectorBug', () => {
- // nwsapi is used by JSDOM
+ // nwsapi is used by JSDOM
const dom = new JSDOM();
const {document} = dom.window;
const div = document.createElement('div');
div.innerHTML = '<div class="b"><div class="c"></div></div>';
const c = div.querySelector('.c');
- expect(() => c.matches('.a:nth-last-of-type(1) .b .c')).not.toThrow();
+ expect(() => {
+ if (c === null) { throw new Error('Element not found'); }
+ c.matches('.a:nth-last-of-type(1) .b .c');
+ }).not.toThrow();
});
}
+/** */
export function testJSDOM() {
testJSDOMSelectorBug();
}
+/** */
function main() {
testJSDOM();
}