Yeah, I did that and it works, but I was only able to get it to work by hard-coding the HTML content.
beforeEach(inject(function($rootScope, $compile, $injector, $templateCache) {
$templateCache.put('../../views/smart_panel/include/library.html', '<div>Library</div>');
// Declare the directive HTML.
element = angular.element('<smart-sub-panel></smart-sub-panel>');
// Define the root scope.
scope = $rootScope;
// Compile and digest the directive.
$compile(element)(scope);
scope.$digest();
}));
it('should have a template title', inject(function($compile, $rootScope) {
var title = element.find('div');
expect(title.length).toBe(2);
expect(title.eq(1).text()).toBe('Library');
}));
I would like to replace the hard-coded HTML, with the actual template referenced as the first argument to $templateCache.