// Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import { filterHTML } from "."; describe("filterHTML", () => { test("zero input creates zero output", () => { expect(filterHTML("", true, false)).toBe(""); expect(filterHTML("", true, false)).toBe(""); expect(filterHTML("", false, false)).toBe(""); }); test("internal filtering", () => { // font-size is filtered, weight is not expect( filterHTML( '
', true, true, ), ).toBe('
'); }); test("background color", () => { // transparent is stripped, other colors are not expect( filterHTML( '', false, true, ), ).toBe(''); expect( filterHTML('', false, true), ).toBe(''); // except if extended mode is off expect( filterHTML('x', false, false), ).toBe("x"); // or if it's an internal paste expect( filterHTML('', true, true), ).toBe(''); }); });