File tree 2 files changed +5
-13
lines changed 2 files changed +5
-13
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ export const PageButton = ({
29
29
aria-label = { `${ page === activePage ? "Current Page" : "" } ${
30
30
page === numPages ? "Last Page" : ""
31
31
} Page${ page } `}
32
- name = "Page button"
32
+ name = { page === undefined ? undefined : "Page button" }
33
33
onClick = { ( ) => onPageClick && page && onPageClick ( page ) }
34
34
disabled = { disabled }
35
35
>
Original file line number Diff line number Diff line change 1
1
import { screen } from "@testing-library/react"
2
2
import { render } from "../../testHelpers/renderHelpers"
3
3
import { PaginationWidget } from "./PaginationWidget"
4
+ import { createPaginationRef } from "./utils"
4
5
5
6
describe ( "PaginatedList" , ( ) => {
6
7
it ( "displays an accessible previous and next button regardless of the number of pages" , async ( ) => {
7
8
const { container } = render (
8
9
< PaginationWidget
9
10
prevLabel = "Previous"
10
11
nextLabel = "Next"
11
- onPrevClick = { ( ) => jest . fn ( ) }
12
- onNextClick = { ( ) => jest . fn ( ) }
12
+ paginationRef = { createPaginationRef ( { page : 1 , limit : 25 } ) }
13
13
/> ,
14
14
)
15
15
@@ -30,12 +30,8 @@ describe("PaginatedList", () => {
30
30
< PaginationWidget
31
31
prevLabel = "Previous"
32
32
nextLabel = "Next"
33
- onPrevClick = { ( ) => jest . fn ( ) }
34
- onNextClick = { ( ) => jest . fn ( ) }
35
- onPageClick = { ( _ ) => jest . fn ( ) }
36
33
numRecords = { 200 }
37
- numRecordsPerPage = { 12 }
38
- activePage = { 1 }
34
+ paginationRef = { createPaginationRef ( { page : 1 , limit : 12 } ) }
39
35
/> ,
40
36
)
41
37
@@ -50,12 +46,8 @@ describe("PaginatedList", () => {
50
46
< PaginationWidget
51
47
prevLabel = "Previous"
52
48
nextLabel = "Next"
53
- onPrevClick = { ( ) => jest . fn ( ) }
54
- onNextClick = { ( ) => jest . fn ( ) }
55
- onPageClick = { ( _ ) => jest . fn ( ) }
56
49
numRecords = { 200 }
57
- numRecordsPerPage = { 12 }
58
- activePage = { 6 }
50
+ paginationRef = { createPaginationRef ( { page : 6 , limit : 12 } ) }
59
51
/> ,
60
52
)
61
53
You can’t perform that action at this time.
0 commit comments