import { describe, expect, it } from "vitest";
import { sanitizeInlineHtml } from "../lib/html";
describe("sanitizeInlineHtml", () => {
it("keeps the tags a rich text paragraph draws", () => {
expect(sanitizeInlineHtml("bold and italic")).toBe("bold and italic");
expect(sanitizeInlineHtml("x2 and ai")).toBe("x2 and ai");
});
it("keeps a style declaration it can use and drops the rest", () => {
const input = 'x';
expect(sanitizeInlineHtml(input)).toBe('x');
});
it("drops a style value that reaches outside the document", () => {
expect(sanitizeInlineHtml('x')).toBe(
"x",
);
expect(sanitizeInlineHtml('x')).toBe(
'x',
);
});
it("drops an event handler", () => {
expect(sanitizeInlineHtml('x')).toBe("x");
});
it("removes a script with the code inside it", () => {
expect(sanitizeInlineHtml("ok")).toBe("ok");
expect(sanitizeInlineHtml("ok")).toBe("ok");
expect(sanitizeInlineHtml('ok')).toBe("ok");
expect(sanitizeInlineHtml("