From f5aa57dcab75e0eb13b4f90f6354aa422828ea49 Mon Sep 17 00:00:00 2001 From: WillGibson Date: Mon, 10 Sep 2018 22:56:08 +0100 Subject: [PATCH] Update sanitize-html tests to cover with & without parser options (#28682) See https://github.com/punkave/sanitize-html/issues/248#issuecomment-418859354 for context Re: "Increase the version number in the header if appropriate." My brain is not able to figure out what that means. - [x] Use a meaningful title for the pull request. Include the name of the package modified. - [x] Test the change in your own code. (Compile and run.) - [x] Add or edit tests to reflect the change. (Run with `npm test`.) - [x] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#make-a-pull-request). - [x] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#common-mistakes). - [x] Run `npm run lint package-name` (or `tsc` if no `tslint.json` is present). If changing an existing definition: - [x] Provide a URL to documentation or source code which provides context for the suggested changes: <> - [ ] Increase the version number in the header if appropriate. - [ ] If you are making substantial changes, consider adding a `tslint.json` containing `{ "extends": "dtslint/dt.json" }`. --- types/sanitize-html/sanitize-html-tests.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/types/sanitize-html/sanitize-html-tests.ts b/types/sanitize-html/sanitize-html-tests.ts index 51d03bf3fe..0fbce8ed44 100644 --- a/types/sanitize-html/sanitize-html-tests.ts +++ b/types/sanitize-html/sanitize-html-tests.ts @@ -29,12 +29,15 @@ let options: sanitize.IOptions = { allowedSchemesByTag: { 'a': ['http', 'https'] }, - allowProtocolRelative: false, - parser: { - decodeEntities: true - } + allowProtocolRelative: false }; let unsafe = '
'; let safe = sanitize(unsafe, options); + +options.parser = { + decodeEntities: true +}; + +safe = sanitize(unsafe, options);