Skip to content

Commit

Permalink
feat(VItemGroup): add tag prop to component (#12771)
Browse files Browse the repository at this point in the history
resolves #11392
  • Loading branch information
ElijahKotyluk committed Dec 23, 2020
1 parent 09ddab5 commit e3378fc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/vuetify/src/components/VItemGroup/VItemGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ export const BaseItemGroup = mixins(
default: null,
},
multiple: Boolean,
tag: {
type: String,
default: 'div',
},
},

data () {
Expand Down Expand Up @@ -248,7 +252,7 @@ export const BaseItemGroup = mixins(
},

render (h): VNode {
return h('div', this.genData(), this.$slots.default)
return h(this.tag, this.genData(), this.$slots.default)
},
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,4 +377,14 @@ describe('VItemGroup', () => {
expect(wrapper.vm.selectedIndex).toBe(2)
expect(wrapper.vm.selectedItem).toEqual(wrapper.vm.items[2])
})

it('should render with a specified tag when the tag prop is provided with a value', () => {
const wrapper = mountFunction({
propsData: {
tag: 'button',
},
})

expect(wrapper.is('button')).toBe(true)
})
})

0 comments on commit e3378fc

Please sign in to comment.