title: Why does this Jasmine test fail and do all function have to be on the scope to be tested?
body: <p>This is a two pronged question:</p>
  
  <p><strong>First Question</strong></p>
  
  <p>In Jasmine based Angular testing do all functions have to be on the scope to be tested? For example if I call a function in the test suite like this:</p>
  
  <pre><code>searchTabController.disableDateFields()
  </code></pre>
  
  <p>I get the following:</p>
  
  <pre><code>TypeError: 'undefined' is not a function
  </code></pre>
  
  <p><strong>Second question</strong> 
  I'm trying to test that the property of a component was set. The first <code>expect</code> passes and determines whether or not the component exists but the second <code>expect</code> fails - why?</p>
  
  <p>If I comment out the first 3 lines and run the second three it still fails - how should this be properly tested?</p>
  
  <pre><code> it( 'disableDateFields() should disable all date fields', function() {
  
      // Passes
      expect( $('#visSearchFrom') ).toBeDefined();
      var strgState = $('#visSearchFrom').attr('disabled');
      expect( strgState ).toBe( 'disabled' );
  
      $('#visSearchFrom').prop('disabled', true);
      var state = $('#visSearchFrom').prop('disabled'); 
      expect( state ).toBe( true );  
  });
  </code></pre>
  
  <p>The error returned from both fails is this: </p>
  
  <pre><code>* Expected undefined to be 'disabled' 
  </code></pre>
  
  <p>or</p>
  
  <pre><code>* Expected undefined to be true
  </code></pre>
  
  <p>The actual function that I'm testing looks like this:  </p>
  
  <pre><code> function disableDateFields() {
  
          $('#visSearchFrom').prop('disabled', true);
          $('#visSearchTo').prop('disabled', true);
          $("input[name='chkCurrentWeek']").attr("disabled", "disabled");
      };
  </code></pre>