Skip to content

Commit 0e8d8f4

Browse files
committed
use the more generic sanitizer option instead of sanitizerRemoveHtml in tests
1 parent 44da69e commit 0e8d8f4

4 files changed

+6
-5
lines changed

test/specs/run-spec.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ function runSpecs(title, dir, showCompletionTable, options) {
1616
spec.options = Object.assign({}, options, (spec.options || {}));
1717
const example = (spec.example ? ' example ' + spec.example : '');
1818
const passFail = (spec.shouldFail ? 'fail' : 'pass');
19-
if (spec.options.sanitizerRemoveHtml) {
20-
spec.options.sanitizer = () => '';
19+
if (spec.options.sanitizer) {
20+
// eslint-disable-next-line no-eval
21+
spec.options.sanitizer = eval(spec.options.sanitizer);
2122
}
2223
(spec.only ? fit : it)('should ' + passFail + example, () => {
2324
const before = process.hrtime();
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
sanitize: true
3-
sanitizerRemoveHtml: true
3+
sanitizer: () => ''
44
---
55
<a>a2<a2t>a2</a> b <c>c</c> d
66
# ![text](URL)
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
22
sanitize: true
3-
sanitizerRemoveHtml: true
3+
sanitizer: () => ''
44
---
55
AAA<script> <img <script> src=x onerror=alert(1) />BBB
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
22
sanitize: true
3-
sanitizerRemoveHtml: true
3+
sanitizer: () => ''
44
---
55
AAA<sometag> <img <sometag> src=x onerror=alert(1)BBB

0 commit comments

Comments
 (0)