Skip to content

Commit

Permalink
fix b-button nativeType for tag 'input' (#3859)
Browse files Browse the repository at this point in the history
  • Loading branch information
mistersaal committed Nov 20, 2023
1 parent 703018e commit 181e987
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/components/button/Button.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,12 @@ describe('BButton', () => {
})
expect(wrapper.element.type).toBeFalsy()
})

it('should set type attribute if the tag is input', () => {
wrapper.setProps({
tag: 'input',
nativeType: 'submit'
})
expect(wrapper.element.type).toBe('submit')
})
})
2 changes: 1 addition & 1 deletion src/components/button/Button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
:is="computedTag"
class="button"
v-bind="$attrs"
:type="computedTag === 'button' ? nativeType : undefined"
:type="['button', 'input'].includes(computedTag) ? nativeType : undefined"
:class="[size, type, {
'is-rounded': rounded,
'is-loading': loading,
Expand Down

0 comments on commit 181e987

Please sign in to comment.