我正在尝试将单元测试添加到Angular 2应用程序中。在我的一个组件中,有一个带有(click)处理程序的按钮。当用户单击按钮时,将调用一个在.ts类文件中定义的函数。该函数在console.log窗口中打印一条消息,表明已按下该按钮。我当前的测试代码对console.log消息的打印进行了测试:
describe('Component: ComponentToBeTested', () => {
    var component: ComponentToBeTested;
    beforeEach(() => {
        component = new ComponentToBeTested();
        spyOn(console, 'log');
    });
    it('should call onEditButtonClick() and print console.log', () => {
        component.onEditButtonClick();
        expect(console.log).toHaveBeenCalledWith('Edit button has been clicked!);
    });
});
但是,这仅测试控制器类,而不测试HTML。我不仅要测试onEditButtonClick调用时是否发生日志记录,还需要进行测试。我还想测试onEditButtonClick用户单击组件的HTML文件中定义的编辑按钮时调用的方法。我怎样才能做到这一点?