'use strict'; describe('scriptDirective', function() { var element; afterEach(function() { dealoc(element); }); it('should populate $templateCache with contents of a ng-template script element', inject( function($compile, $templateCache) { $compile('
foo' + '' + '' + '
'); expect($templateCache.get('/myTemplate.html')).toBe('{{y}}'); expect($templateCache.get('/ignore')).toBeUndefined(); } )); it('should not compile scripts', inject(function($compile, $templateCache, $rootScope) { var doc = jqLite('
'); // jQuery is too smart and removes script tags doc[0].innerHTML = 'foo' + '' + ''; $compile(doc)($rootScope); $rootScope.$digest(); var scripts = doc.find('script'); expect(scripts.eq(0)[0].text).toBe('some {{binding}}'); expect(scripts.eq(1)[0].text).toBe('other {{binding}}'); dealoc(doc); })); });