From 9ad79331566e0671788b120cc1f682f4e7f33f44 Mon Sep 17 00:00:00 2001 From: yehuya <> Date: Wed, 22 Jan 2025 14:01:41 +0200 Subject: [PATCH] tests: DOMPurify custom window tests improvements --- test/test-suite.js | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/test/test-suite.js b/test/test-suite.js index 1885fc05..29560a13 100644 --- a/test/test-suite.js +++ b/test/test-suite.js @@ -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( @@ -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'); });