title: W3C Notification Coverage
body: <p>I'm having trouble getting my Code Coverage to 100% due to the W3C Notification not being available for PhantomJS. I have the following function:</p>
  
  <pre><code>function requirespermission(overwrite){
      if(overwrite || (typeof Notification !== 'undefined' &amp;&amp; Notification.permission === 'granted'))
      {
          return true; 
      }
      else if(!overwrite || typeof Notification !== 'undefined'){
          Notification.requestPermission();
      }
      return false;
  }
  </code></pre>
  
  <p>and my tests are the following:</p>
  
  <pre><code>it('should be able to get permission', function(){
      notificationservice.requirespermission(true);
  });
  
  it('should be able to not get permission', function(){
      notificationservice.requirespermission(false);
  });
  </code></pre>
  
  <p>but whatever I do, the condition coverage of the else function stays at 2/4 (which makes sense, but I have to implement the check for cross-browser support). I use the following tools:</p>
  
  <ul>
  <li>Karma + Jasmine for the tests</li>
  <li>karma-coverage for the coverage</li>
  <li>PhantomJS as the unit test browser</li>
  <li>Cobertura as reporter</li>
  <li>(Jenkins as CI)</li>
  </ul>
  
  <p>How can I get the else function to pass the code coverage tests?</p>