import { html, fixture, expect } from "@open-wc/testing"; import IconPack from "@ollion/flow-system-icon/dist/types/icon-pack"; // import flow-core elements import "@ollion/flow-core"; import { ConfigUtil, FCheckbox } from "@ollion/flow-core"; import { FTable, FTcell } from "@ollion/flow-table"; ConfigUtil.setConfig({ iconPack: IconPack }); describe("f-table", () => { it("is defined", () => { const el = document.createElement("f-table"); expect(el).instanceOf(FTable); }); it("should display checkboxes when selectable='multiple'", async () => { const el = await fixture( html` ${[1, 2, 3, 4, 5].map(cellNumber => { return html` Header ${cellNumber} `; })} ${[1, 2].map(_rowNumber => { return html` ${[1, 2, 3, 4, 5].map(cellNumber => { return html` Column ${cellNumber} `; })} `; })} ` ); await el.updateComplete; const cells = el?.querySelectorAll(".test-checkbox"); await Promise.all([cells[0].updateComplete, cells[1].updateComplete]); for (let i = 0; i < cells.length; i++) { const checkbox = cells[i].shadowRoot?.querySelector("f-checkbox"); expect(checkbox?.value).to.equal("checked"); } }); });