角度2单元测试 - 在每个单元测试之前调整窗口大小

时间:2016-10-05 14:25:33

标签: angular

我正在测试属性指令。该指令的大多数功能都可以在小屏幕尺寸上进行测试。在执行每个测试用例之前,如何提供窗口对象并将其调整为特定的宽度和高度?

beforeEach(() => {
  fixture = TestBed.configureTestingModule({
    declarations: [ TestComponent, NavDirective]
  })
  .createComponent(TestComponent);
  fixture.detectChanges();
});

it('should open when trigger button is clicked', () => {
  //write tests to simulate a click on the trigger button 
  //but it is visible only when the screen size is small
});

0 个答案:

没有答案