From 717fca46e7231d0c6c55deb37e5007d80e74f708 Mon Sep 17 00:00:00 2001 From: Fasih Mehmood Date: Thu, 31 Oct 2024 10:53:52 +0500 Subject: [PATCH] fix(TablePaginationControls): Hide page text when page input is hidden --- .../TablePaginationControls/TablePaginationControls.test.tsx | 1 + .../TablePaginationControls/TablePaginationControls.tsx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/TablePagination/TablePaginationControls/TablePaginationControls.test.tsx b/src/components/TablePagination/TablePaginationControls/TablePaginationControls.test.tsx index c3ba1cf8..c458d768 100644 --- a/src/components/TablePagination/TablePaginationControls/TablePaginationControls.test.tsx +++ b/src/components/TablePagination/TablePaginationControls/TablePaginationControls.test.tsx @@ -112,6 +112,7 @@ describe("", () => { expect( screen.queryByRole("spinbutton", { name: Label.PAGE_NUMBER }), ).not.toBeInTheDocument(); + expect(screen.queryByText("of 5")).not.toBeInTheDocument(); }); it("can display the description", async () => { diff --git a/src/components/TablePagination/TablePaginationControls/TablePaginationControls.tsx b/src/components/TablePagination/TablePaginationControls/TablePaginationControls.tsx index 3e75ed14..208dfe46 100644 --- a/src/components/TablePagination/TablePaginationControls/TablePaginationControls.tsx +++ b/src/components/TablePagination/TablePaginationControls/TablePaginationControls.tsx @@ -138,9 +138,9 @@ const TablePaginationControls = ({ value={currentPage} type="number" />{" "} + {typeof totalPages === "number" ? `of ${totalPages}` : null} ) : null} - {typeof totalPages === "number" ? `of ${totalPages}` : null}