Skip to content

Commit

Permalink
chore: add browser test for return-object
Browse files Browse the repository at this point in the history
  • Loading branch information
yuwu9145 committed Oct 22, 2024
1 parent 56bae8e commit 4f5b897
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/vuetify/src/components/VList/VListGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const makeVListGroupProps = propsFactory({
type: IconValue,
default: '$expand',
},
id: String,
id: [String, Number],
prependIcon: IconValue,
appendIcon: IconValue,
fluid: Boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,52 @@ describe('VListGroup', () => {
expect(opened.value).toStrictEqual(['Users'])
expect(screen.getByCSS('.v-list-group__items')).toBeVisible()
})

it('should correctly set v-model:opened when return-object is applied', async () => {
const opened: Ref = ref([])
const items: Ref = ref([
{
title: 'Item #1',
newValue: 1,
children: [
{
title: 'Child 1',
newValue: 100,
},
],
},
{
title: 'Item #2',
newValue: 2,
},
{
title: 'Item #3',
newValue: 3,
},
])
render(() => (
<VList
v-model:opened={ opened.value }
itemValue="newValue"
items={ items.value }
returnObject
>
</VList>
))

expect(opened.value).toStrictEqual([])

await userEvent.click(screen.getByCSS('.v-list-group__header'))

expect(opened.value).toStrictEqual([{
title: 'Item #1',
newValue: 1,
children: [
{
title: 'Child 1',
newValue: 100,
},
],
}])
})
})

0 comments on commit 4f5b897

Please sign in to comment.