如何在角度2中使用karma + jasmine为这个公众编写正确的测试:
public focusElement(element: HTMLElement, event: Event): void {
element.focus();
event.stopPropagation();
event.preventDefault();
}
我从这开始:
describe("LoginComponent", () => {
describe("function focusElement(): void", () => {
let testLoginComponent: LoginComponent;
beforeEach(() => {
testLoginComponent = new LoginComponent(null, null);
});
// test
});
});
});
但我真的明白如何为这个功能编写正确的测试。