title: Angular 2 Unit Tests - Resize Window before each unit tests
body: <p>I am testing an attribute directive. Most of the functionality of the directive can be tested on small screen sizes. How do I provide a window object and resize it to a particular width and height before executing each test case?</p>
  
  <pre><code>beforeEach(() =&gt; {
    fixture = TestBed.configureTestingModule({
      declarations: [ TestComponent, NavDirective]
    })
    .createComponent(TestComponent);
    fixture.detectChanges();
  });
  
  it('should open when trigger button is clicked', () =&gt; {
    //write tests to simulate a click on the trigger button 
    //but it is visible only when the screen size is small
  });
  </code></pre>