Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 14 additions & 0 deletions src/pagination/__tests__/pagination.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(<Pagination currentPageIndex={3} pagesCount={10} jumpToPage={{}} />);

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(<Pagination currentPageIndex={3} pagesCount={10} jumpToPage={{}} />);

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(
<Pagination currentPageIndex={1} pagesCount={10} disabled={true} jumpToPage={{}} />
Expand Down
4 changes: 2 additions & 2 deletions src/test-utils/dom/pagination/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)!;
}

/**
Expand Down
Loading