diff options
| author | Patrick H. Lauke <[email protected]> | 2020-06-19 09:31:37 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-06-19 11:31:37 +0300 |
| commit | edbcc401c28e539ecdcf3c49c7ef2a74d0c28ebd (patch) | |
| tree | a1e408cd3c48309c49fc06d7dbb52d96ae02fae0 /js/tests | |
| parent | 7acf586d3efa9b2bad6a93d81c7cdc3560de6cdf (diff) | |
| download | bootstrap-edbcc401c28e539ecdcf3c49c7ef2a74d0c28ebd.tar.xz bootstrap-edbcc401c28e539ecdcf3c49c7ef2a74d0c28ebd.zip | |
Change whitelist to allowlist (#31066)
Co-authored-by: XhmikosR <[email protected]>
Co-authored-by: Mark Otto <[email protected]>
Diffstat (limited to 'js/tests')
| -rw-r--r-- | js/tests/unit/util/sanitizer.spec.js | 14 |
1 files changed, 7 insertions, 7 deletions
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', () => { '</div>' ].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', () => { '</div>' ].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 = [ '<div>', ' <script>alert(7)</script>', '</div>' ].join('') - const result = sanitizeHtml(template, DefaultWhitelist, null) + const result = sanitizeHtml(template, DefaultAllowlist, null) expect(result.indexOf('<script>') === -1).toEqual(true) }) @@ -61,7 +61,7 @@ describe('Sanitizer', () => { spyOn(DOMParser.prototype, 'parseFromString') - const result = sanitizeHtml(template, DefaultWhitelist, mySanitize) + const result = sanitizeHtml(template, DefaultAllowlist, mySanitize) expect(result).toEqual(template) expect(DOMParser.prototype.parseFromString).not.toHaveBeenCalled() |
