📜  茉莉花测试按钮点击 - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:15.046000             🧑  作者: Mango

代码示例1
// Define component and fixture within describe()

it('should click button', fakeAsync(() => {
    spyOn(component, 'methodName');

    let btn = fixture.debugElement.query(By.css('.btn-class'));
    btn.triggerEventHandler('click', null);
    fixture.detectChanges();
    expect(component.methodName).toHaveBeenCalled();
}))