Files
cunningham/packages/react/src/components/Pagination/utils.tsx
Nathan Vasse d85f9edac8 🚨(lint) update file for prettier 3.0.0
Prettier 3.0.0 comes with new standards so we need to upgrade our files
to comply with it.
2023-07-18 16:59:39 +02:00

17 lines
604 B
TypeScript

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