-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
30 additions
and
2 deletions.
There are no files selected for viewing
32 changes: 30 additions & 2 deletions
32
vuu-ui/packages/vuu-table/src/__tests__/__component__/Table.cy.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
}); | ||
}); |