import { html, fixture, expect } from "@open-wc/testing"; import { register } from "@nonfx/flow-icons"; register(["system"]); // import flow-core elements import "@nonfx/flow-core"; import { FCheckbox } from "@nonfx/flow-core"; import { FTable, FTcell } from "@nonfx/flow-table"; 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"); } }); });