Skip to content

Commit

Permalink
fix(VDataIterator): emit page-count event (#10652)
Browse files Browse the repository at this point in the history
closes #8886
  • Loading branch information
nekosaur authored Feb 25, 2020
1 parent 1244991 commit 4d04771
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ export default Themeable.extend({
this.internalCurrentItems = v
this.$emit('current-items', v)
},
'page-count': (v: number) => this.$emit('page-count', v),
},
scopedSlots: {
default: this.genDefaultScopedSlot,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,4 +323,28 @@ describe('VDataIterator.ts', () => {

expect(wrapper.html()).toMatchSnapshot()
})

// https://github.com/vuetifyjs/vuetify/issues/8886
it('should emit page-count event', async () => {
const pageCount = jest.fn()
const wrapper = mountFunction({
propsData: {
items: [
'foo',
'bar',
'baz',
'qux',
],
itemsPerPage: 1,
},
listeners: {
pageCount,
},
})

wrapper.setProps({ itemsPerPage: 4 })
await wrapper.vm.$nextTick()

expect(wrapper.emitted('page-count')).toEqual([[4], [1]])
})
})

0 comments on commit 4d04771

Please sign in to comment.