// sum.test.ts import { expect } from "vitest"; import TestUtils from "@supersoniks/concorde/test-utils/TestUtils"; import "./if"; function create() { return TestUtils.bootstrap(`Some Content`)[0]; } test("shows ''Some Content'' condition = true set by property accessor", async () => { const elt: any = create(); elt.condition = true; await elt.updated(); const renderedText = elt.shadowRoot.children[0].assignedNodes()[0].textContent; expect(renderedText).toBe("Some Content"); }); test("shows nothing condition = false set by property accessor", async () => { const elt: any = create(); elt.condition = false; await elt.updated(); const children = Array.from(elt.shadowRoot.children).filter( (elt: any) => elt.nodeName.toLowerCase() != "style" ); const length = children.length; expect(length).toBe(0); }); test("shows ''Some Content'' condition = true set by attribute", async () => { const elt: any = create(); elt.setAttribute("condition", ""); await elt.updated(); const renderedText = elt.shadowRoot.children[0].assignedNodes()[0].textContent; expect(renderedText).toBe("Some Content"); }); test("shows nothing condition not set", async () => { const elt: any = create(); await elt.updated(); const children = Array.from(elt.shadowRoot.children).filter( (elt: any) => elt.nodeName.toLowerCase() != "style" ); const length = children.length; expect(length).toBe(0); });