From edbcc401c28e539ecdcf3c49c7ef2a74d0c28ebd Mon Sep 17 00:00:00 2001 From: "Patrick H. Lauke" Date: Fri, 19 Jun 2020 09:31:37 +0100 Subject: Change whitelist to allowlist (#31066) Co-authored-by: XhmikosR Co-authored-by: Mark Otto --- js/tests/unit/util/sanitizer.spec.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'js/tests') diff --git a/js/tests/unit/util/sanitizer.spec.js b/js/tests/unit/util/sanitizer.spec.js index c4259e7fd..dcfad8436 100644 --- a/js/tests/unit/util/sanitizer.spec.js +++ b/js/tests/unit/util/sanitizer.spec.js @@ -1,11 +1,11 @@ -import { DefaultWhitelist, sanitizeHtml } from '../../../src/util/sanitizer' +import { DefaultAllowlist, sanitizeHtml } from '../../../src/util/sanitizer' describe('Sanitizer', () => { describe('sanitizeHtml', () => { it('should return the same on empty string', () => { const empty = '' - const result = sanitizeHtml(empty, DefaultWhitelist, null) + const result = sanitizeHtml(empty, DefaultAllowlist, null) expect(result).toEqual(empty) }) @@ -18,7 +18,7 @@ describe('Sanitizer', () => { '' ].join('') - const result = sanitizeHtml(template, DefaultWhitelist, null) + const result = sanitizeHtml(template, DefaultAllowlist, null) expect(result.indexOf('script') === -1).toEqual(true) }) @@ -30,20 +30,20 @@ describe('Sanitizer', () => { '' ].join('') - const result = sanitizeHtml(template, DefaultWhitelist, null) + const result = sanitizeHtml(template, DefaultAllowlist, null) expect(result.indexOf('aria-pressed') !== -1).toEqual(true) expect(result.indexOf('class="test"') !== -1).toEqual(true) }) - it('should remove not whitelist tags', () => { + it('should remove tags not in allowlist', () => { const template = [ '
', ' ', '
' ].join('') - const result = sanitizeHtml(template, DefaultWhitelist, null) + const result = sanitizeHtml(template, DefaultAllowlist, null) expect(result.indexOf('