Skip to content

Commit 0d64d2b

Browse files
authored
Merge pull request #1060 from yehuya/initializeTestImprovements
tests: DOMPurify custom window test improvement
2 parents 72760ca + 9ad7933 commit 0d64d2b

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

test/test-suite.js

+20-3
Original file line numberDiff line numberDiff line change
@@ -859,15 +859,24 @@
859859
assert.strictEqual(DOMPurify({}).isSupported, false);
860860
assert.strictEqual(DOMPurify({}).sanitize, undefined);
861861
assert.strictEqual(
862-
typeof DOMPurify({ document: 'not really a document' }).version,
862+
typeof DOMPurify({
863+
document: 'not really a document',
864+
Element: window.Element,
865+
}).version,
863866
'string'
864867
);
865868
assert.strictEqual(
866-
DOMPurify({ document: 'not really a document' }).isSupported,
869+
DOMPurify({
870+
document: 'not really a document',
871+
Element: window.Element,
872+
}).isSupported,
867873
false
868874
);
869875
assert.strictEqual(
870-
DOMPurify({ document: 'not really a document' }).sanitize,
876+
DOMPurify({
877+
document: 'not really a document',
878+
Element: window.Element,
879+
}).sanitize,
871880
undefined
872881
);
873882
assert.strictEqual(
@@ -882,6 +891,14 @@
882891
DOMPurify({ document, Element: undefined }).sanitize,
883892
undefined
884893
);
894+
assert.strictEqual(
895+
typeof DOMPurify({ document, Element: window.Element }).version,
896+
'string'
897+
);
898+
assert.strictEqual(
899+
typeof DOMPurify({ document, Element: window.Element }).sanitize,
900+
'function'
901+
);
885902
assert.strictEqual(typeof DOMPurify(window).version, 'string');
886903
assert.strictEqual(typeof DOMPurify(window).sanitize, 'function');
887904
});

0 commit comments

Comments
 (0)