import { describe, expect, it } from "vitest"; import { normalizeMarkup, serialize } from "./serialize.js"; describe("serialize", () => { it("writes attributes in name order and escapes text, so two frameworks' output can be compared", () => { const el = document.createElement("div"); el.innerHTML = ''; expect(serialize(el.firstChild as Node)).toBe(''); }); }); describe("normalizeMarkup", () => { it("drops comment nodes and whitespace between elements", () => { expect(normalizeMarkup("
a\n b
")).toBe("
ab
"); }); it("replaces generated ids in id-carrying attributes only", () => { const html = '
p
'; expect(normalizeMarkup(html)).toBe('
p
'); }); it("drops the value, checked and spellcheck attributes of form controls, whose DOM state is the same either way", () => { expect(normalizeMarkup('')).toBe(''); }); });