我想使用ts-mockito测试从材质对话框实例dialogEvent
触发的事件 () :
myFunc() {
this.matDialogRef = this.matDialog.open(DialogComponent);
this.matDialogRef.componentInstance.dialogEvent.subscribe(() => {
this.doSomething();
});
}
我如何在测试中监视或模拟它?
it('should call doSomething() on dialogEvent', () => {
// trigger DialogComponent.dialogEvent event here
expect(comp.doSomething).toHaveBeenCalled();
});