diff --git a/src/__tests__/snapshot-tests/__snapshots__/test-utils-selectors.test.tsx.snap b/src/__tests__/snapshot-tests/__snapshots__/test-utils-selectors.test.tsx.snap index c1d4fc8b09..16e98a9c41 100644 --- a/src/__tests__/snapshot-tests/__snapshots__/test-utils-selectors.test.tsx.snap +++ b/src/__tests__/snapshot-tests/__snapshots__/test-utils-selectors.test.tsx.snap @@ -493,6 +493,7 @@ exports[`test-utils selectors 1`] = ` "awsui_root_efqlv", ], "pagination": [ + "awsui_arrow_fvjdu", "awsui_button-current_fvjdu", "awsui_button_fvjdu", "awsui_jump-to-page-input_fvjdu", diff --git a/src/pagination/__tests__/pagination.test.tsx b/src/pagination/__tests__/pagination.test.tsx index 46f7d546bf..2c0db69bfa 100644 --- a/src/pagination/__tests__/pagination.test.tsx +++ b/src/pagination/__tests__/pagination.test.tsx @@ -334,6 +334,20 @@ describe('jump to page', () => { expect(wrapper.findJumpToPageButton()).toBeTruthy(); }); + test('findNextPageButton returns the next arrow when jumpToPage is present', () => { + const { wrapper } = renderPagination(); + + expect(wrapper.findNextPageButton()).not.toBeNull(); + expect(wrapper.findNextPageButton().getElement().tagName.toLowerCase()).toBe('button'); + }); + + test('findPreviousPageButton returns the previous arrow when jumpToPage is present', () => { + const { wrapper } = renderPagination(); + + expect(wrapper.findPreviousPageButton()).not.toBeNull(); + expect(wrapper.findPreviousPageButton().getElement().tagName.toLowerCase()).toBe('button'); + }); + test('should disable jump to page input and button when pagination is disabled', () => { const { wrapper } = renderPagination( diff --git a/src/test-utils/dom/pagination/index.ts b/src/test-utils/dom/pagination/index.ts index 024fcd4db2..ad779e638b 100644 --- a/src/test-utils/dom/pagination/index.ts +++ b/src/test-utils/dom/pagination/index.ts @@ -40,11 +40,11 @@ export default class PaginationWrapper extends ComponentWrapper { } findPreviousPageButton(): PaginationButtonWrapper { - return this.findComponent(`li:first-child .${styles.button}`, PaginationButtonWrapper)!; + return this.findComponent(`li:first-child .${styles.arrow}`, PaginationButtonWrapper)!; } findNextPageButton(): PaginationButtonWrapper { - return this.findComponent(`li:last-child .${styles.button}`, PaginationButtonWrapper)!; + return this.findComponent(`li:not(:first-child) .${styles.arrow}`, PaginationButtonWrapper)!; } /**