mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
test(Search): improve test coverage
This commit is contained in:
parent
f3d045cd61
commit
c821ccbf2b
@ -119,3 +119,21 @@ test('should render action text when using action-text prop', () => {
|
||||
|
||||
expect(wrapper.find('.van-search__action').html()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('should call input.focus when vm.focus is called', () => {
|
||||
const wrapper = mount(Search);
|
||||
const onFocus = jest.fn();
|
||||
wrapper.find('input').element.focus = onFocus;
|
||||
|
||||
wrapper.vm.focus();
|
||||
expect(onFocus).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
test('should call input.blur when vm.blur is called', () => {
|
||||
const wrapper = mount(Search);
|
||||
const onBlur = jest.fn();
|
||||
wrapper.find('input').element.blur = onBlur;
|
||||
|
||||
wrapper.vm.blur();
|
||||
expect(onBlur).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user