Skip to content

Commit

Permalink
chore: formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
haideralsh committed Jan 6, 2025
1 parent 2420252 commit 18099a9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/Pagination/Pagination.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe("Pagination", () => {
onNext={onNextCallback}
onPrevious={onPreviousCallback}
onSelectPage={onSelectPageCallback}
/>,
/>
);
const clickPage = (pageNum: number) => {
fireEvent.click(getAllByLabelText("Go to page {{count}}")[pageNum]);
Expand All @@ -78,7 +78,7 @@ describe("Pagination", () => {
onNext={onNextCallback}
onPrevious={onPreviousCallback}
onSelectPage={onSelectPageCallback}
/>,
/>
);
const clickPrevious = () => {
const PreviousButton = getByLabelText("Go to previous results");
Expand All @@ -95,7 +95,7 @@ describe("Pagination", () => {
onNext={onNextCallback}
onPrevious={onPreviousCallback}
onSelectPage={onSelectPageCallback}
/>,
/>
);
const clickPrevious = () => {
const PreviousButton = getByLabelText("Go to previous results");
Expand All @@ -112,7 +112,7 @@ describe("Pagination", () => {
onNext={onNextCallback}
onPrevious={onPreviousCallback}
onSelectPage={onSelectPageCallback}
/>,
/>
);
const NextButton = getByLabelText("Go to next results");

Expand Down
26 changes: 13 additions & 13 deletions src/Table/Table.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe("Table", () => {
const callback = jest.fn();

const { container } = renderWithNDSProvider(
<Table columns={columns} rows={rowData} hasSelectableRows keyField="c1" onRowSelectionChange={callback} />,
<Table columns={columns} rows={rowData} hasSelectableRows keyField="c1" onRowSelectionChange={callback} />
);

fireEvent.click(container.querySelectorAll("input")[1]);
Expand All @@ -30,7 +30,7 @@ describe("Table", () => {
const callback = jest.fn();

const { container } = renderWithNDSProvider(
<Table columns={columns} rows={rowData} hasSelectableRows keyField="c1" onRowSelectionChange={callback} />,
<Table columns={columns} rows={rowData} hasSelectableRows keyField="c1" onRowSelectionChange={callback} />
);

fireEvent.click(container.querySelectorAll("input")[0]);
Expand Down Expand Up @@ -67,7 +67,7 @@ describe("Table", () => {
const callback = jest.fn();

const { container } = renderWithNDSProvider(
<Table columns={getMockColumns(3)} rows={rowData} hasExpandableRows onRowExpansionChange={callback} />,
<Table columns={getMockColumns(3)} rows={rowData} hasExpandableRows onRowExpansionChange={callback} />
);

fireEvent.click(container.querySelectorAll("button")[0]);
Expand Down Expand Up @@ -99,7 +99,7 @@ describe("Table", () => {
const callback = jest.fn();

const { container } = renderWithNDSProvider(
<Table columns={getMockColumns(3)} rows={rowData} hasExpandableRows onRowExpansionChange={callback} />,
<Table columns={getMockColumns(3)} rows={rowData} hasExpandableRows onRowExpansionChange={callback} />
);

fireEvent.click(container.querySelectorAll("button")[1]);
Expand Down Expand Up @@ -127,7 +127,7 @@ describe("Table", () => {
keyField="c1"
rowsPerPage={6}
onPageChange={pageChangeCallback}
/>,
/>
);
const onClickPage = (pageNum) => {
wrapper.find("button").at(pageNum).simulate("click");
Expand All @@ -146,7 +146,7 @@ describe("Table", () => {
keyField="c1"
rowsPerPage={6}
onPageChange={pageChangeCallback}
/>,
/>
);
const paginationButtons = wrapper.find("button");
const nextButton = paginationButtons.last();
Expand All @@ -168,15 +168,15 @@ describe("Table", () => {
keyField="c1"
rowsPerPage={6}
onPageChange={pageChangeCallback}
/>,
/>
);
const rows = wrapper.find("tbody tr");
expect(rows.length).toEqual(ROWS_PER_PAGE);
});

it("renders the inner Pagination with correct props", () => {
const wrapper = mountWithNDSProvider(
<Table columns={mockColumns} rows={getMockRows(20)} hasSelectableRows keyField="c1" rowsPerPage={6} />,
<Table columns={mockColumns} rows={getMockRows(20)} hasSelectableRows keyField="c1" rowsPerPage={6} />
);
const pagination = wrapper.find(Pagination);
expect(pagination.length).toEqual(1);
Expand All @@ -186,7 +186,7 @@ describe("Table", () => {

it("does not display pagination when rowsPerPage is falsy", () => {
const wrapper = mountWithNDSProvider(
<Table columns={mockColumns} rows={getMockRows(20)} hasSelectableRows keyField="c1" />,
<Table columns={mockColumns} rows={getMockRows(20)} hasSelectableRows keyField="c1" />
);
const pagination = wrapper.find(Pagination);
const rows = wrapper.find("tbody tr");
Expand All @@ -199,7 +199,7 @@ describe("Table", () => {
describe("loading", () => {
it("shows only loading text when loading", () => {
const wrapper = mountWithNDSProvider(
<Table columns={mockColumns} rows={getMockRows(20)} hasSelectableRows loading />,
<Table columns={mockColumns} rows={getMockRows(20)} hasSelectableRows loading />
);
const rows = wrapper.find("tbody tr");
const loadingCell = wrapper.find("tbody tr td");
Expand All @@ -210,7 +210,7 @@ describe("Table", () => {
it("shows rows when not loading", () => {
const rowData = getMockRows(20);
const wrapper = mountWithNDSProvider(
<Table columns={mockColumns} rows={rowData} hasSelectableRows loading={false} />,
<Table columns={mockColumns} rows={rowData} hasSelectableRows loading={false} />
);
const rows = wrapper.find("tbody tr");
const cell = wrapper.find("tbody tr td");
Expand All @@ -227,7 +227,7 @@ describe("Table", () => {
const callback = jest.fn();

const { getAllByTestId } = renderWithNDSProvider(
<Table columns={columns} rows={rowData} keyField="c1" onRowMouseEnter={callback} />,
<Table columns={columns} rows={rowData} keyField="c1" onRowMouseEnter={callback} />
);

fireEvent.mouseEnter(getAllByTestId("table-row")[1]);
Expand All @@ -245,7 +245,7 @@ describe("Table", () => {
const callback = jest.fn();

const { getAllByTestId } = renderWithNDSProvider(
<Table columns={columns} rows={rowData} keyField="c1" onRowMouseLeave={callback} />,
<Table columns={columns} rows={rowData} keyField="c1" onRowMouseLeave={callback} />
);

fireEvent.mouseLeave(getAllByTestId("table-row")[1]);
Expand Down

0 comments on commit 18099a9

Please sign in to comment.