[improvement] optimize jest fn called judgement (#3029)

This commit is contained in:
neverland
2019-03-21 18:57:44 +08:00
committed by GitHub
parent 7c4908a2e3
commit 8c051b8e1f
24 changed files with 63 additions and 64 deletions
+3 -3
View File
@@ -26,7 +26,7 @@ test('click icon event', () => {
expect(wrapper.emitted('click-icon')).toBeTruthy();
expect(wrapper.emitted('click-left-icon')).toBeTruthy();
expect(wrapper.emitted('click-right-icon')).toBeTruthy();
expect(onIconClick.mock.calls.length).toBe(1);
expect(onIconClick).toHaveBeenCalled();
});
test('keypress event', () => {
@@ -111,7 +111,7 @@ test('blur method', () => {
wrapper.find('input').element.focus();
wrapper.vm.blur();
expect(fn.mock.calls.length).toEqual(1);
expect(fn).toHaveBeenCalledTimes(1);
});
test('focus method', () => {
@@ -121,7 +121,7 @@ test('focus method', () => {
wrapper.vm.$on('focus', fn);
wrapper.vm.focus();
expect(fn.mock.calls.length).toEqual(1);
expect(fn).toHaveBeenCalledTimes(1);
});
test('maxlength', async () => {