Skip to content

Commit

Permalink
WIP tests
Browse files Browse the repository at this point in the history
  • Loading branch information
heswell committed Jan 24, 2024
1 parent b16c129 commit 905bfd0
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions vuu-ui/packages/vuu-table/src/__tests__/__component__/Table.cy.tsx
Original file line number Diff line number Diff line change
@@ -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(
<Instruments
<SimulTable
data-testid="table"
renderBufferSize={5}
height={625}
tableName="instruments"
width={800}
/>
);
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(
<TestTable
data-testid="table"
renderBufferSize={5}
headerHeight={25}
height={625}
rowHeight={20}
width={1000}
/>
);

// 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");
});
});

0 comments on commit 905bfd0

Please sign in to comment.