From 0e8d8f47680d7b2833a3a6c84b5751d0da9197fe Mon Sep 17 00:00:00 2001 From: KT Date: Fri, 28 Jun 2019 21:31:03 +0200 Subject: [PATCH] use the more generic `sanitizer` option instead of `sanitizerRemoveHtml` in tests --- test/specs/run-spec.js | 5 +++-- test/specs/security/sanitizer_bypass_remove_generic.md | 2 +- test/specs/security/sanitizer_bypass_remove_script.md | 2 +- test/specs/security/sanitizer_bypass_remove_tag.md | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/test/specs/run-spec.js b/test/specs/run-spec.js index 37fe5e1c72..b962a1f7cc 100644 --- a/test/specs/run-spec.js +++ b/test/specs/run-spec.js @@ -16,8 +16,9 @@ function runSpecs(title, dir, showCompletionTable, options) { spec.options = Object.assign({}, options, (spec.options || {})); const example = (spec.example ? ' example ' + spec.example : ''); const passFail = (spec.shouldFail ? 'fail' : 'pass'); - if (spec.options.sanitizerRemoveHtml) { - spec.options.sanitizer = () => ''; + if (spec.options.sanitizer) { + // eslint-disable-next-line no-eval + spec.options.sanitizer = eval(spec.options.sanitizer); } (spec.only ? fit : it)('should ' + passFail + example, () => { const before = process.hrtime(); diff --git a/test/specs/security/sanitizer_bypass_remove_generic.md b/test/specs/security/sanitizer_bypass_remove_generic.md index 41aca6277c..4718f8438d 100644 --- a/test/specs/security/sanitizer_bypass_remove_generic.md +++ b/test/specs/security/sanitizer_bypass_remove_generic.md @@ -1,6 +1,6 @@ --- sanitize: true -sanitizerRemoveHtml: true +sanitizer: () => '' --- a2a2 b c d # ![text](URL) \ No newline at end of file diff --git a/test/specs/security/sanitizer_bypass_remove_script.md b/test/specs/security/sanitizer_bypass_remove_script.md index 9334070021..3c3b940545 100644 --- a/test/specs/security/sanitizer_bypass_remove_script.md +++ b/test/specs/security/sanitizer_bypass_remove_script.md @@ -1,5 +1,5 @@ --- sanitize: true -sanitizerRemoveHtml: true +sanitizer: () => '' --- AAA