@@ -118,6 +118,7 @@ test('has correct DOM structure when on page 2', function () {
118
118
} ) ;
119
119
120
120
test ( 'emits correct event' , function ( ) {
121
+ exampleData . current_page = 1 ;
121
122
const wrapper = mount ( TailwindPagination , {
122
123
props : {
123
124
data : exampleData ,
@@ -131,6 +132,32 @@ test('emits correct event', function () {
131
132
expect ( event [ 0 ] ) . toEqual ( [ 2 ] ) ;
132
133
} ) ;
133
134
135
+ test ( 'does not emit event on current page' , function ( ) {
136
+ exampleData . current_page = 1 ;
137
+ const wrapper = mount ( TailwindPagination , {
138
+ props : {
139
+ data : exampleData ,
140
+ } ,
141
+ } ) ;
142
+
143
+ wrapper . findAll ( 'button' ) . at ( 1 ) . trigger ( 'click' ) ;
144
+
145
+ const event = wrapper . emitted ( 'pagination-change-page' ) ;
146
+ expect ( event ) . toBeUndefined ( ) ;
147
+ } ) ;
148
+
149
+ test ( 'current page button is disabled' , function ( ) {
150
+ exampleData . current_page = 1 ;
151
+ const wrapper = mount ( TailwindPagination , {
152
+ props : {
153
+ data : exampleData ,
154
+ } ,
155
+ } ) ;
156
+
157
+ const button = wrapper . findAll ( 'button' ) . at ( 1 ) ;
158
+ expect ( button . attributes ( 'disabled' ) ) . toBe ( '' ) ;
159
+ } ) ;
160
+
134
161
test ( 'has correct DOM structure when using slots' , function ( ) {
135
162
const wrapper = mount ( TailwindPagination , {
136
163
props : { data : exampleData } ,
0 commit comments