feat(NumberKeyboard): add blur-on-close prop (#8033)

This commit is contained in:
neverland
2021-01-28 21:23:55 +08:00
committed by GitHub
parent 67d44a0fa5
commit 4834549d9f
4 changed files with 27 additions and 2 deletions
+16
View File
@@ -39,10 +39,13 @@ test('should should emit blur event when hidden', () => {
test('should emit close event after clicking close button', () => {
const wrapper = mount(NumberKeyboard, {
props: {
show: true,
theme: 'custom',
},
});
clickKey(wrapper.findAll('.van-key')[12]);
expect(wrapper.emitted('blur')).toBeTruthy();
expect(wrapper.emitted('close')).toBeTruthy();
});
@@ -230,3 +233,16 @@ test('should shuffle key order when using random-key-order prop', () => {
expect(keys.every((v, k) => keys[k] === clickKeys[k])).toEqual(false);
});
test('should not emit close event after clicking close button when blur-on-close is false', () => {
const wrapper = mount(NumberKeyboard, {
props: {
show: true,
theme: 'custom',
blurOnClose: false,
},
});
clickKey(wrapper.findAll('.van-key')[12]);
expect(wrapper.emitted('blur')).toBeFalsy();
});