title: Accessing compiled template in unit tests
body: <p>Most of the Angular tutorials talk about using end to end tests with Protractor to test whether the compiled template came out as expected. I'm wondering if it's possible to do this with unit tests at all.</p>
  
  <p>Most of the tutorials that do talk about referencing HTML code in unit tests describe compiling your own written code in the test, for example, to make sure a directive is being accessed correctly:</p>
  
  <pre><code>describe('some function', function () {
    it('should do something', inject(function ($compile, $rootScope) {
      var element = $compile('&lt;div id = "foo" ng-hide = "somecondition"&gt;Bar&lt;/div&gt;')($Scope);
      $rootScope.digest();
      //Search for a given DOM element and perform some test here
    }));
  });
  </code></pre>
  
  <p>But let's say I want to test the code in the actual template file. Like if I wanted to test whether ng-hide was successfully set. I want to be able to do something like:</p>
  
  <pre><code>describe('some function', function () {
    it('should do something', function () {
      //Get the div with ID 'foo' in the compiled template
      var elm = $('#foo');
      expect(elm.css('display')).toEqual('none');
    });
  });
  </code></pre>
  
  <p>This doesn't work when I do it. <code>elm</code> gets set to some HTML/Javascript code, but not the template's code, and <code>elm.css('display')</code> comes back as undefined.</p>
  
  <p>Is there a way to unit test this with the Jasmine/Angular set up?</p>