import { describe, expect, it } from "vitest"; import { removeElementFromHtml } from "./sourceMutation.js"; describe("removeElementFromHtml", () => { it("removes a self-closing element by id", () => { const html = `
`; const updated = removeElementFromHtml(html, { id: "photo" }); expect(updated).not.toContain(`id="photo"`); expect(updated).toContain(`id="rest"`); }); it("removes a matched composition host by selector", () => { const html = `
Scene A
`; const updated = removeElementFromHtml(html, { selector: '[data-composition-id="scene-a"]', }); expect(updated).not.toContain(`data-composition-id="scene-a"`); expect(updated).toContain(`data-composition-id="scene-b"`); }); it("supports fragment html by returning updated body markup", () => { const html = `
`; expect(removeElementFromHtml(html, { id: "photo" })).toBe(`
`); }); });