Files
coder/site/src/components/PaginationWidget/PaginationWidget.test.tsx
Bruno Quaresma 869d040cc6 chore(site): refactor stories and tests from components directory (#9578)
* Refactor Alert

* Refactor Avatar and its stories

* Refactor AvatarData and its stories

* Refactor CodeExample and its tests

* Refactor ServiceBanner stories

* Refactor Navbar and its tests

* Refactor ServiceBanner stories

* Refactor LicenseBannerView stories

* Refactor DeploymentBannerView stories

* Extract optionValue into a module

* Refactor DeleteDialog stories

* Refactor ConfirmDialog tests

* Refactor EmptyState tests

* Flat ErrorBoundaryState and refactor stories

* Refactor Expander stories

* Refactor FormFooter stories

* Refactor FullPageForm stories

* Refactor EnterpriseSnackbar stories

* Refactor GroupAvatar stories

* Refactor HelpTooltip stories and remove index

* Remove unecessary types module from IconField

* Refactor LoadingButton stories

* Refactor Margins stories

* Refactor Markdown stories

* Refactor PageHeader stories

* Refactor PageButton tests

* Refactor Pill stories

* Refactor Resources stories

* Refactor RichParameterInput stories and flat MultiTextField

* Remove unecessary Stack story

* Refactor TableRowMenu stories

* Refactor TemplateLayout stories

* Refactor Typography props

* Refactor UserAutocomplete

* Refactor WorkspaceBuildLogs components and tests

* Refactor WorkspaceStatusBadge stories

* Fix wrong imports

* Remove Example.args pattern

* Fix wrong import

* Refactor EmptyState stories

* Refactor HelpTooltip stories

* Remove not valid ErrorAlert story

* Fix AvatarData story

* Add border back to CodeExample

* Fix Navbar story

* Fix AgentRow proxy in the stories
2023-09-07 18:38:28 +02:00

29 lines
868 B
TypeScript

import { screen } from "@testing-library/react";
import { render } from "testHelpers/renderHelpers";
import { PaginationWidget } from "./PaginationWidget";
import { createPaginationRef } from "./utils";
describe("PaginatedList", () => {
it("disables the previous button on the first page", () => {
render(
<PaginationWidget
numRecords={100}
paginationRef={createPaginationRef({ page: 1, limit: 25 })}
/>,
);
const prevButton = screen.getByLabelText("Previous page");
expect(prevButton).toBeDisabled();
});
it("disables the next button on the last page", () => {
render(
<PaginationWidget
numRecords={100}
paginationRef={createPaginationRef({ page: 4, limit: 25 })}
/>,
);
const nextButton = screen.getByLabelText("Next page");
expect(nextButton).toBeDisabled();
});
});