summaryrefslogtreecommitdiff
path: root/test/jsdom.test.js
diff options
context:
space:
mode:
authorDarius Jahandarie <djahandarie@gmail.com>2023-12-06 03:53:16 +0000
committerGitHub <noreply@github.com>2023-12-06 03:53:16 +0000
commitbd5bc1a5db29903bc098995cd9262c4576bf76af (patch)
treec9214189e0214480fcf6539ad1c6327aef6cbd1c /test/jsdom.test.js
parentfd6bba8a2a869eaf2b2c1fa49001f933fce3c618 (diff)
parent23e6fb76319c9ed7c9bcdc3efba39bc5dd38f288 (diff)
Merge pull request #339 from toasted-nutbread/type-annotations
Type annotations
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();
}