Skip to content

Commit

Permalink
test(VData): group items with sort disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Sören Lerch committed May 22, 2021
1 parent 369faa5 commit 55317dc
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions packages/vuetify/src/components/VData/__tests__/VData.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -562,4 +562,38 @@ describe('VData.ts', () => {

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

// https://github.com/vuetifyjs/vuetify/issues/11905
it('should group items when sort is disabled', async () => {
const render = jest.fn()
const items = [
{ id: 1, text: 'foo', baz: 'one' },
{ id: 2, text: 'bar', baz: 'two' },
{ id: 3, text: 'baz', baz: 'one' },
]

const wrapper = mountFunction({
propsData: {
items,
groupBy: ['baz'],
disableSort: true,
},
scopedSlots: {
default: render,
},
})

expect(render).toHaveBeenCalledWith(expect.objectContaining({
groupedItems: [
{
name: 'one',
items: [items[0], items[2]],
},
{
name: 'two',
items: [items[1]],
},
],
}))
})
})

0 comments on commit 55317dc

Please sign in to comment.