Skip to content

Commit c94cb09

Browse files
committed
feat: CPagination: add arg 'reduced' to the 'update:activePage' event
1 parent 79d6e11 commit c94cb09

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/components/pagination/CPagination.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
immediate: true,
130130
handler (val) {
131131
if (val && val < this.activePage) {
132-
this.$emit('update:activePage', val)
132+
this.$emit('update:activePage', val, true)
133133
}
134134
}
135135
}
@@ -187,7 +187,7 @@
187187
if (number === this.activePage) {
188188
return
189189
}
190-
this.$emit('update:activePage', number)
190+
this.$emit('update:activePage', number, false)
191191
if (e) {
192192
this.changeFocus(e)
193193
}

src/components/pagination/tests/CPagination.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ describe(ComponentName, () => {
3737
})
3838
it('emits update:activePage event when number of pages change', () => {
3939
customWrapper.setProps({ pages: 6 })
40-
expect(customWrapper.emitted()['update:activePage']).toBeTruthy()
40+
expect(customWrapper.emitted()['update:activePage'][0]).toMatchObject([6, true])
4141
})
4242
it('emits update:activePage event when inactive item is clicked', () => {
4343
const links = wrapper.findAll('.page-link')
4444
links.at(2).trigger('click')
4545
expect(wrapper.emitted()['update:activePage']).not.toBeTruthy()
4646

4747
links.at(4).trigger('click')
48-
expect(wrapper.emitted()['update:activePage']).toBeTruthy()
48+
expect(wrapper.emitted()['update:activePage'][0]).toMatchObject([3, false])
4949
})
5050
it('calls focus function when clicked on numeric item', () => {
5151
const spy = jest.spyOn(wrapper.vm, 'changeFocus')

0 commit comments

Comments
 (0)