title: AngularJS test a directive with replace set to true
body: <p>My <code>&lt;custom-directive&gt;</code> has <code>replace:true</code> and <code>template: '&lt;img /&gt;'</code>.
  How can I write a unit test for it? I think I want to test that it actually replaces custom-directive with img.</p>
  
  <pre><code>it('should be transformed to &lt;img&gt;', function(){
    var elm = $compile('&lt;custom-directive&gt;&lt;/custom-directive&gt;')(scope);
    scope.$digest();
  
    var t = elm.find('img'); // wrong! it replaces the element. it won't find another one inside
   //expect(elm).toBeAnImgElement ?
  });
  </code></pre>
  
  <p>I can't find the correct matcher.
  The closest case I've seen is checking the contents (<code>elm.html()</code> or <code>elm.text()</code>) but my tag is empty.</p>