[IMP] add support for top level comments

This commit is contained in:
Géry Debongnie
2021-11-29 13:22:04 +01:00
committed by Aaron Bohy
parent 779003e715
commit 8a1ac13975
53 changed files with 1086 additions and 1042 deletions
+26
View File
@@ -0,0 +1,26 @@
import { comment, mount } from "../../src/blockdom";
import { makeTestFixture } from "./helpers";
//------------------------------------------------------------------------------
// Setup and helpers
//------------------------------------------------------------------------------
let fixture: HTMLElement;
beforeEach(() => {
fixture = makeTestFixture();
});
afterEach(() => {
fixture.remove();
});
test("simple comment node", async () => {
const tree = comment("foo");
expect(tree.el).toBe(undefined);
mount(tree, fixture);
expect(fixture.innerHTML).toBe("<!--foo-->");
expect(tree.el).not.toBe(undefined);
tree.remove();
expect(fixture.innerHTML).toBe("");
});