')($rootScope);
      $rootScope.$apply();
      $httpBackend.flush();
      expect(contentOnLink).toBe('someContent');
    });
  });
  it('should add the content to the element before compiling it', function() {
    var root;
    module(function() {
      directive('test', function() {
        return {
          link: function(scope, element) {
            root = element.parent().parent();
          }
        };
      });
    });
    inject(function($compile, $rootScope, $httpBackend) {
      $httpBackend.expectGET('include.html').respond('
')($rootScope);
      $rootScope.$apply();
      $httpBackend.flush();
      expect(root[0]).toBe(element[0]);
    });
  });
});
describe('ngInclude animations', function() {
  var body, element, $rootElement;
  function html(html) {
    $rootElement.html(html);
    element = $rootElement.children().eq(0);
    return element;
  }
  beforeEach(module(function() {
    // we need to run animation on attached elements;
    return function(_$rootElement_) {
      $rootElement = _$rootElement_;
      body = jqLite(document.body);
      body.append($rootElement);
    };
  }));
  afterEach(function(){
    dealoc(body);
    dealoc(element);
  });
  beforeEach(module('mock.animate'));
  afterEach(function(){
    dealoc(element);
  });
  it('should fire off the enter animation',
    inject(function($compile, $rootScope, $templateCache, $animate) {
      var item;
      $templateCache.put('enter', [200, '
data
', {}]);
      $rootScope.tpl = 'enter';
      element = $compile(html(
        '
'
      ))($rootScope);
      $rootScope.$digest();
      item = $animate.flushNext('enter').element;
      expect(item.text()).toBe('data');
  }));
  it('should fire off the leave animation',
    inject(function($compile, $rootScope, $templateCache, $animate) {
      var item;
      $templateCache.put('enter', [200, '
data
', {}]);
      $rootScope.tpl = 'enter';
      element = $compile(html(
        '
'
      ))($rootScope);
      $rootScope.$digest();
      item = $animate.flushNext('enter').element;
      expect(item.text()).toBe('data');
      $rootScope.tpl = '';
      $rootScope.$digest();
      item = $animate.flushNext('leave').element;
      expect(item.text()).toBe('data');
  }));
  it('should animate two separate ngInclude elements',
    inject(function($compile, $rootScope, $templateCache, $animate) {
      var item;
      $templateCache.put('one', [200, 'one', {}]);
      $templateCache.put('two', [200, 'two', {}]);
      $rootScope.tpl = 'one';
      element = $compile(html(
        '
'
      ))($rootScope);
      $rootScope.$digest();
      item = $animate.flushNext('enter').element;
      expect(item.text()).toBe('one');
      $rootScope.tpl = 'two';
      $rootScope.$digest();
      var itemA = $animate.flushNext('leave').element;
      var itemB = $animate.flushNext('enter').element;
      expect(itemA.attr('ng-include')).toBe('tpl');
      expect(itemB.attr('ng-include')).toBe('tpl');
      expect(itemA).not.toEqual(itemB);
  }));
});