Skip to content

Commit

Permalink
Merge pull request #1060 from yehuya/initializeTestImprovements
Browse files Browse the repository at this point in the history
tests: DOMPurify custom window test improvement
  • Loading branch information
cure53 authored Jan 22, 2025
2 parents 72760ca + 9ad7933 commit 0d64d2b
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions test/test-suite.js
Original file line number Diff line number Diff line change
Expand Up @@ -859,15 +859,24 @@
assert.strictEqual(DOMPurify({}).isSupported, false);
assert.strictEqual(DOMPurify({}).sanitize, undefined);
assert.strictEqual(
typeof DOMPurify({ document: 'not really a document' }).version,
typeof DOMPurify({
document: 'not really a document',
Element: window.Element,
}).version,
'string'
);
assert.strictEqual(
DOMPurify({ document: 'not really a document' }).isSupported,
DOMPurify({
document: 'not really a document',
Element: window.Element,
}).isSupported,
false
);
assert.strictEqual(
DOMPurify({ document: 'not really a document' }).sanitize,
DOMPurify({
document: 'not really a document',
Element: window.Element,
}).sanitize,
undefined
);
assert.strictEqual(
Expand All @@ -882,6 +891,14 @@
DOMPurify({ document, Element: undefined }).sanitize,
undefined
);
assert.strictEqual(
typeof DOMPurify({ document, Element: window.Element }).version,
'string'
);
assert.strictEqual(
typeof DOMPurify({ document, Element: window.Element }).sanitize,
'function'
);
assert.strictEqual(typeof DOMPurify(window).version, 'string');
assert.strictEqual(typeof DOMPurify(window).sanitize, 'function');
});
Expand Down

0 comments on commit 0d64d2b

Please sign in to comment.