diff --git a/vuu-ui/packages/vuu-table/src/__tests__/__component__/Table.cy.tsx b/vuu-ui/packages/vuu-table/src/__tests__/__component__/Table.cy.tsx index a733530f3..50c74b297 100644 --- a/vuu-ui/packages/vuu-table/src/__tests__/__component__/Table.cy.tsx +++ b/vuu-ui/packages/vuu-table/src/__tests__/__component__/Table.cy.tsx @@ -1,18 +1,46 @@ import React from "react"; // TODO try and get TS path alias working to avoid relative paths like this -import { Instruments } from "../../../../../showcase/src/examples/Table/SIMUL.examples"; +import { SimulTable } from "../../../../../showcase/src/examples/Table/SIMUL.examples"; +import { TestTable } from "../../../../../showcase/src/examples/Table/Table.examples"; + +const withAriaIndex = (index: number) => ({ + name: (_: string, el: Element) => el.ariaRowIndex === `${index}`, +}); describe("WHEN it initially renders", () => { it("THEN expected classname is present", () => { cy.mount( - ); const container = cy.findByTestId("table"); container.should("have.class", "vuuTable"); }); + + it("THEN expected number of rows are present, with buffered rows, all with correct aria index", () => { + cy.mount( + + ); + + // Note the Table Headers row is included in count + const container = cy.findAllByRole("row").should("have.length", 36); + cy.findByRole("row", withAriaIndex(0)).should("not.exist"); + cy.findByRole("row", withAriaIndex(1)).should("be.visible"); + cy.findByRole("row", withAriaIndex(30)).should("be.visible"); + cy.findByRole("row", withAriaIndex(31)).should("not.be.visible"); + cy.findByRole("row", withAriaIndex(35)).should("not.be.visible"); + cy.findByRole("row", withAriaIndex(36)).should("not.exist"); + }); });