fix(components): [switch] tabindex property doesn't work (#8101)

This commit is contained in:
류한경 2022-06-08 10:23:49 +09:00 committed by GitHub
parent 4ef6ee28a8
commit 4c34660c59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 0 deletions

View File

@ -42,6 +42,15 @@ describe('Switch.vue', () => {
expect(wrapper.find('.el-switch--large').exists()).toBe(true)
})
test('tabindex', () => {
const wrapper = mount(Switch, {
props: {
tabindex: '0',
},
})
expect(wrapper.find('.el-switch__input').attributes().tabindex).toBe('0')
})
test('inline prompt', () => {
const wrapper = mount(Switch, {
props: {

View File

@ -93,6 +93,9 @@ export const switchProps = buildProps({
type: String as PropType<ComponentSize>,
validator: isValidComponentSize,
},
tabindex: {
type: [String, Number],
},
} as const)
export type SwitchProps = ExtractPropTypes<typeof switchProps>

View File

@ -12,6 +12,7 @@
:true-value="activeValue"
:false-value="inactiveValue"
:disabled="switchDisabled"
:tabindex="tabindex"
@change="handleChange"
@keydown.enter="switchValue"
/>