(react) add Pagination component

In order to create a DataGrid we first need a fully working pagination
component. It comes with multiples working examples in the documentation.
This commit is contained in:
Nathan Vasse
2023-02-20 16:27:37 +01:00
committed by NathanVss
parent 90feb4ba4a
commit 88e478d9f6
11 changed files with 584 additions and 7 deletions

View File

@@ -0,0 +1,16 @@
export const expectPaginationList = (
expectations: { text: string; name?: string; disabled?: boolean }[]
) => {
const buttons = document.querySelectorAll(".c__pagination__list > *");
expect(buttons.length).toEqual(expectations.length);
buttons.forEach((button, k) => {
const expected = expectations[k];
if (expected.name) {
expect(button.getAttribute("aria-label")).toEqual(expected.name);
}
expect(button.textContent).toEqual(expected.text);
if (expected.disabled !== undefined) {
expect(button.hasAttribute("disabled")).toBe(expected.disabled);
}
});
};