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: <<url here>>
- [ ] 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" }`.
This commit is contained in:
WillGibson
2018-09-10 14:56:08 -07:00
committed by Ryan Cavanaugh
parent a7201a4a4b
commit f5aa57dcab
+7 -4
View File
@@ -29,12 +29,15 @@ let options: sanitize.IOptions = {
allowedSchemesByTag: {
'a': ['http', 'https']
},
allowProtocolRelative: false,
parser: {
decodeEntities: true
}
allowProtocolRelative: false
};
let unsafe = '<div><script>alert("hello");</script></div>';
let safe = sanitize(unsafe, options);
options.parser = {
decodeEntities: true
};
safe = sanitize(unsafe, options);