@joist/element
Version:
Intelligently apply styles to WebComponents
32 lines (26 loc) • 703 B
text/typescript
import { assert } from "chai";
import { element } from "./element.js";
import { ready } from "./lifecycle.js";
it("should call all callbacks when template is ready", () => {
({
tagName: "template-ready-1",
})
class MyElement extends HTMLElement {
callCount: Record<string, number> = {};
()
onTemplateReady1() {
this.callCount.onTemplateReady1 ??= 0;
this.callCount.onTemplateReady1++;
}
()
onTemplateReady2() {
this.callCount.onTemplateReady2 ??= 0;
this.callCount.onTemplateReady2++;
}
}
const el = new MyElement();
assert.deepEqual(el.callCount, {
onTemplateReady1: 1,
onTemplateReady2: 1,
});
});