import { default as PrettyText, buildOptions } from 'pretty-text/pretty-text'; import { hrefAllowed } from 'pretty-text/sanitizer'; module("lib:sanitizer"); test("sanitize", function() { const pt = new PrettyText(buildOptions({ siteSettings: {} })); const cooked = (input, expected, text) => equal(pt.cook(input), expected.replace(/\/>/g, ">"), text); equal(pt.sanitize("bug"), "bug"); equal(pt.sanitize("
"), ""); equal(pt.sanitize("hello
hello
hello
", "it sanitizes while cooking"); cooked("disney reddit", "", "we can embed proper links"); cooked("hello
", "it does not allow centering"); cooked("hello |
after
", "it does not allow tables"); cooked("a\n\n", "
a\n\n", "it does not double sanitize"); cooked("", "", "it does not allow most iframes"); cooked("", "", "it allows iframe to google maps"); cooked("", "", "it allows iframe to OpenStreetMap"); equal(pt.sanitize(""), "hullo"); equal(pt.sanitize(""), "press me!"); equal(pt.sanitize(""), "draw me!"); equal(pt.sanitize("
\n\n