From 6dba800ff8b22f8a30f8102923a5b43348e5c745 Mon Sep 17 00:00:00 2001 From: heswell Date: Wed, 24 Jan 2024 08:35:02 +0000 Subject: [PATCH] WIP tests --- .../src/__tests__/__component__/Table.cy.tsx | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) 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 a733530f32..50c74b2972 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"); + }); });