title: Test `window.location.href` in Angular 4 Unit test
body: <p>I am trying to test a method in Angular4 which depends on <code>window.location.href</code></p>
  
  <p>My Method is as: </p>
  
  <pre><code>navigatePage(code: string) {
     const codeURL= (&lt;HTMLInputElement&gt;document.getElementsByClassName('urlvalue')[0])
                          .value;
     window.location.href = codeURL;
  }
  </code></pre>
  
  <p>To Test this method, i have written code as follows:</p>
  
  <pre><code>describe('navigate to url', () =&gt; {
      it('should call click', () =&gt; {
        fixture.whenStable().then(() =&gt; {
          component.navigatePage(data.results[0].code);
        });
      });
  });
  </code></pre>
  
  <p>When i check in test-coverage report then i see below line as not covered.</p>
  
  <pre><code>window.location.href = codeURL
  </code></pre>
  
  <p>Please assist.</p>