具有多个键码的Jasmine单元测试

时间:2018-10-23 20:26:06

标签: javascript angular unit-testing jasmine angular5

如果用户使用茉莉花按角度5的shift + Tab键,我需要一个可以调用函数的单元

我尝试了这个,但是我没有调用函数

在我的html文件中,我有这个          <div (keyup.shift.tab)=myFunction($event)"></div>

在我的component.ts中

   MyFunction(e){
     return "call function"
   }

在我的景点

     it('call function with shift tab', () => {
       event.type = 'keyup';
       event.keyCode = 9;
       component.MyFunction(event);
       expect(component.MyFunction).toHaveBeenCalled();
    });

0 个答案:

没有答案
相关问题