title: Angular testing with Jasmine can't compare html node
body: <p>I am building directive tests in Angular using Jasmine. I have a small example test which looks like this:</p>
  
  <pre><code>it("should compare html node", inject( function ($compile, $rootScope) {
    var elm = angular.element('&lt;input&gt;');
    elm = $compile(elm)($scope);
    $scope.$digest();
    console.log('btn', elm); // output: '&lt;input class="ng-scope"&gt;'
    expect(elm).toBe('&lt;input class="ng-scope"&gt;');
  
    expect(elm[0]).toBe('&lt;input class="ng-scope"&gt;'); // these also fail
    expect(elm.html()).toBe('&lt;input class="ng-scope"&gt;'); // ""
  }));
  </code></pre>
  
  <p>So I get the expected output to the console, but Jasmine complains with an error <code>Expected { length: 1, 0: HTMLNode } to be '&lt;input class="ng-scope"&gt;'</code></p>
  
  <p>I have also tried using <code>elm[0]</code> which gives the same error and <code>elm.html()</code> but that just returns an empty string. How can I compare the HTML Node with the string correctly?</p>
  
  <p>NB I know this is an unrealistic test, but I just want to demo my current issue.</p>