@@ -33,36 +33,37 @@ describe('UUIPaginationElement', () => {
33
33
it ( 'sets active class on current page' , async ( ) => {
34
34
await waitUntil ( ( ) => element . visiblePages . length > 1 ) ;
35
35
element . current = 2 ;
36
- const button = element . shadowRoot ?. querySelector ( '#group' ) ?. children [ 3 ] ! ;
36
+ const button = element . shadowRoot ?. querySelector ( '#group' ) !
37
+ . children [ 3 ] as HTMLElement ;
37
38
await elementUpdated ( button ) ;
38
39
39
- await expect ( button ) . to . have . class ( 'active-button' ) ;
40
+ expect ( button ) . to . have . class ( 'active-button' ) ;
40
41
} ) ;
41
42
42
43
it ( 'goes to selected page on click' , async ( ) => {
43
44
await waitUntil ( ( ) => element . visiblePages . length > 1 ) ;
44
- const button = element . shadowRoot ?. querySelector ( '#group' )
45
- ? .children [ 3 ] ! as HTMLElement ;
45
+ const button = element . shadowRoot ?. querySelector ( '#group' ) !
46
+ . children [ 3 ] as HTMLElement ;
46
47
button . click ( ) ;
47
48
48
49
await elementUpdated ( element ) ;
49
50
50
- await expect ( button ) . to . have . class ( 'active-button' ) ;
51
- await expect ( element . current ) . to . equal ( 2 ) ;
51
+ expect ( button ) . to . have . class ( 'active-button' ) ;
52
+ expect ( element . current ) . to . equal ( 2 ) ;
52
53
} ) ;
53
54
54
55
it ( 'goes to previous page on click' , async ( ) => {
55
56
await waitUntil ( ( ) => element . visiblePages . length > 1 ) ;
56
57
element . current = 2 ;
57
- const buttons = element . shadowRoot ?. querySelector ( '#group' ) ? .children ;
58
+ const buttons = element . shadowRoot ?. querySelector ( '#group' ) ! . children ;
58
59
const prevButton = buttons ! [ 1 ] as HTMLElement ;
59
60
const activeButton = buttons ! [ 2 ] as HTMLElement ;
60
61
prevButton . click ( ) ;
61
62
62
63
await elementUpdated ( element ) ;
63
64
64
- await expect ( element . current ) . to . equal ( 1 ) ;
65
- await expect ( activeButton ) . to . have . class ( 'active-button' ) ;
65
+ expect ( element . current ) . to . equal ( 1 ) ;
66
+ expect ( activeButton ) . to . have . class ( 'active-button' ) ;
66
67
} ) ;
67
68
68
69
it ( 'goes to next page on click' , async ( ) => {
@@ -75,8 +76,8 @@ describe('UUIPaginationElement', () => {
75
76
76
77
await elementUpdated ( element ) ;
77
78
78
- await expect ( element . current ) . to . equal ( 3 ) ;
79
- await expect ( activeButton ) . to . have . class ( 'active-button' ) ;
79
+ expect ( element . current ) . to . equal ( 3 ) ;
80
+ expect ( activeButton ) . to . have . class ( 'active-button' ) ;
80
81
} ) ;
81
82
82
83
it ( 'goes to last page on click and disables last and next buttons' , async ( ) => {
@@ -91,10 +92,10 @@ describe('UUIPaginationElement', () => {
91
92
buttons = element . shadowRoot ?. querySelector ( '#group' ) ?. children ;
92
93
const activeButton = buttons ! [ 5 ] as HTMLElement ;
93
94
94
- await expect ( element . current ) . to . equal ( 30 ) ;
95
- await expect ( activeButton ) . to . have . class ( 'active-button' ) ;
96
- await expect ( nextButton ) . to . have . attribute ( 'disabled' ) ;
97
- await expect ( lastButton ) . to . have . attribute ( 'disabled' ) ;
95
+ expect ( element . current ) . to . equal ( 30 ) ;
96
+ expect ( activeButton ) . to . have . class ( 'active-button' ) ;
97
+ expect ( nextButton ) . to . have . attribute ( 'disabled' ) ;
98
+ expect ( lastButton ) . to . have . attribute ( 'disabled' ) ;
98
99
} ) ;
99
100
100
101
it ( 'goes to first page on click and disables first and previous buttons' , async ( ) => {
@@ -108,10 +109,10 @@ describe('UUIPaginationElement', () => {
108
109
109
110
await elementUpdated ( element ) ;
110
111
111
- await expect ( element . current ) . to . equal ( 1 ) ;
112
- await expect ( activeButton ) . to . have . class ( 'active-button' ) ;
113
- await expect ( firstButton ) . to . have . attribute ( 'disabled' ) ;
114
- await expect ( previousButton ) . to . have . attribute ( 'disabled' ) ;
112
+ expect ( element . current ) . to . equal ( 1 ) ;
113
+ expect ( activeButton ) . to . have . class ( 'active-button' ) ;
114
+ expect ( firstButton ) . to . have . attribute ( 'disabled' ) ;
115
+ expect ( previousButton ) . to . have . attribute ( 'disabled' ) ;
115
116
} ) ;
116
117
117
118
it ( 'shows the dots when more pages than visible' , async ( ) => {
@@ -125,7 +126,7 @@ describe('UUIPaginationElement', () => {
125
126
const hasDots =
126
127
arr . filter ( ( e : HTMLElement ) => e . classList . contains ( 'dots-button' ) )
127
128
. length > 0 ;
128
- await expect ( hasDots ) . to . be . true ;
129
+ expect ( hasDots ) . to . be . true ;
129
130
} ) ;
130
131
131
132
it ( 'hides the dots when only one page' , async ( ) => {
@@ -139,10 +140,10 @@ describe('UUIPaginationElement', () => {
139
140
const hasDots =
140
141
arr . filter ( ( e : HTMLElement ) => e . classList . contains ( 'dots-button' ) )
141
142
. length > 0 ;
142
- await expect ( hasDots ) . to . be . false ;
143
+ expect ( hasDots ) . to . be . false ;
143
144
} ) ;
144
145
145
146
it ( 'passes the a11y audit' , async ( ) => {
146
- await expect ( element ) . shadowDom . to . be . accessible ( ) ;
147
+ expect ( element ) . shadowDom . to . be . accessible ( ) ;
147
148
} ) ;
148
149
} ) ;
0 commit comments