diff --git a/packages/checkbox/__tests__/checkbox.spec.ts b/packages/checkbox/__tests__/checkbox.spec.ts index 51c7bf070a..33eab2d81a 100644 --- a/packages/checkbox/__tests__/checkbox.spec.ts +++ b/packages/checkbox/__tests__/checkbox.spec.ts @@ -125,7 +125,7 @@ describe('Checkbox', () => { expect(vm.checkList).toEqual(['a']) }) - test('true false lable', async () => { + test('true false label', async () => { const wrapper = _mount( ``, () => ({ @@ -155,6 +155,27 @@ describe('Checkbox', () => { expect(wrapper.vm.checked).toBe(true) expect(wrapper.vm.checklist).toEqual(['a']) }) + + test('label', async() => { + const wrapper = _mount( + ` +
+ + all + a + b + +
+ `, + () => ({ + checked: false, + checklist: [], + }), + ) + const checkbox = wrapper.find('.el-checkbox') + await checkbox.trigger('click') + expect(wrapper.vm.checklist[0]).toEqual('') + }) }) describe('check-button', () => { diff --git a/packages/checkbox/src/checkbox.vue b/packages/checkbox/src/checkbox.vue index 9d5dd044b1..16419c1bd6 100644 --- a/packages/checkbox/src/checkbox.vue +++ b/packages/checkbox/src/checkbox.vue @@ -75,7 +75,7 @@ export default defineComponent({ default: () => undefined, }, label: { - type: [Boolean, Number, String], + type: [String, Boolean, Number], }, indeterminate: Boolean, disabled: Boolean,