测试单击材料单选按钮不起作用

时间:2020-08-17 12:11:36

标签: angular angular-material

我试图用角形材料单选按钮测试某些组件-

it('should show task', fakeAsync(() => {
    const items = fixture.debugElement.queryAll(By.css('.question-summary'));
    items[0].triggerEventHandler('click', null);
    fixture.detectChanges();
    const buttons = fixture.debugElement.queryAll(By.directive(PriceAnswerButtonComponent));
    expect(buttons.length).toEqual(1);
    const radioButtons = buttons[0].queryAll(By.directive(MatRadioButton));
    radioButtons[0].nativeElement.click();
    fixture.detectChanges();
}));

但我无法使其正常运行,我也尝试了triggerEventHandler('click', null);

0 个答案:

没有答案