@@ -9,17 +9,13 @@ describe("PaginatedList", () => {
9
9
< PaginationWidget
10
10
prevLabel = "Previous"
11
11
nextLabel = "Next"
12
- paginationRef = { createPaginationRef ( { page : 1 , limit : 12 } ) }
12
+ paginationRef = { createPaginationRef ( { page : 2 , limit : 12 } ) }
13
13
numRecords = { 200 }
14
14
/> ,
15
15
)
16
16
17
- expect (
18
- screen . getByRole ( "button" , { name : "Previous page" } ) ,
19
- ) . toBeInTheDocument ( )
20
- expect (
21
- screen . getByRole ( "button" , { name : "Next page" } ) ,
22
- ) . toBeInTheDocument ( )
17
+ expect ( screen . getByRole ( "button" , { name : "Previous page" } ) ) . toBeEnabled ( )
18
+ expect ( screen . getByRole ( "button" , { name : "Next page" } ) ) . toBeEnabled ( )
23
19
} )
24
20
25
21
it ( "displays the expected number of pages with one ellipsis tile" , ( ) => {
@@ -53,4 +49,26 @@ describe("PaginatedList", () => {
53
49
container . querySelectorAll ( `button[name="Page button"]` ) ,
54
50
) . toHaveLength ( 5 )
55
51
} )
52
+
53
+ it ( "disables the previous button on the first page" , ( ) => {
54
+ render (
55
+ < PaginationWidget
56
+ numRecords = { 100 }
57
+ paginationRef = { createPaginationRef ( { page : 1 , limit : 25 } ) }
58
+ /> ,
59
+ )
60
+ const prevButton = screen . getByLabelText ( "Previous page" )
61
+ expect ( prevButton ) . toBeDisabled ( )
62
+ } )
63
+
64
+ it ( "disables the next button on the last page" , ( ) => {
65
+ render (
66
+ < PaginationWidget
67
+ numRecords = { 100 }
68
+ paginationRef = { createPaginationRef ( { page : 4 , limit : 25 } ) }
69
+ /> ,
70
+ )
71
+ const nextButton = screen . getByLabelText ( "Next page" )
72
+ expect ( nextButton ) . toBeDisabled ( )
73
+ } )
56
74
} )
0 commit comments