| OLD | NEW |
| 1 library ng_template_spec; | 1 library ng_template_spec; |
| 2 | 2 |
| 3 import '../_specs.dart'; | 3 import '../_specs.dart'; |
| 4 | 4 |
| 5 main() { | 5 main() { |
| 6 describe('NgTemplateDirective', () { | 6 describe('NgTemplateDirective', () { |
| 7 TestBed _; | 7 TestBed _; |
| 8 var element; | 8 var element; |
| 9 | 9 |
| 10 they(should, htmlForElements, callback) { | 10 they(should, htmlForElements, callback) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 [ // <template> | 24 [ // <template> |
| 25 '<div>foo' + | 25 '<div>foo' + |
| 26 '<template id="/ignore">ignore me</template>' + | 26 '<template id="/ignore">ignore me</template>' + |
| 27 '<template type="text/ng-template" id="/myTemplate.html"><x>{{y}}</x><
/template>' + | 27 '<template type="text/ng-template" id="/myTemplate.html"><x>{{y}}</x><
/template>' + |
| 28 '</div>', | 28 '</div>', |
| 29 // <script> | 29 // <script> |
| 30 '<div>foo' + | 30 '<div>foo' + |
| 31 '<script id="/ignore">ignore me</script>' + | 31 '<script id="/ignore">ignore me</script>' + |
| 32 '<script type="text/ng-template" id="/myTemplate.html"><x>{{y}}</x></s
cript>' + | 32 '<script type="text/ng-template" id="/myTemplate.html"><x>{{y}}</x></s
cript>' + |
| 33 '</div>'], | 33 '</div>'], |
| 34 (Injector injector, Compiler compiler, TemplateCache templateCache, Direct
iveMap directives) { | 34 (Injector injector, Compiler compiler, TemplateCache templateCache) { |
| 35 compiler(element, directives)(injector, element); | 35 compiler(element)(injector, element); |
| 36 expect(templateCache.get('/ignore')).toBeNull(); | 36 expect(templateCache.get('/ignore')).toBeNull(); |
| 37 expect(templateCache.get('/myTemplate.html').responseText).toEqual('<x>{
{y}}</x>'); | 37 expect(templateCache.get('/myTemplate.html').responseText).toEqual('<x>{
{y}}</x>'); |
| 38 } | 38 } |
| 39 ); | 39 ); |
| 40 | 40 |
| 41 they('should not compile template elements', | 41 they('should not compile template elements', |
| 42 [ // <template> | 42 [ // <template> |
| 43 '<div>foo' + | 43 '<div>foo' + |
| 44 '<template type="text/javascript">some {{binding}} <div></div></templa
te>' + | 44 '<template type="text/javascript">some {{binding}} <div></div></templa
te>' + |
| 45 '<template type="text/ng-template" id="/some">other {{binding}} <div><
/div></template>' + | 45 '<template type="text/ng-template" id="/some">other {{binding}} <div><
/div></template>' + |
| 46 '</div>', | 46 '</div>', |
| 47 // <script> | 47 // <script> |
| 48 '<div>foo' + | 48 '<div>foo' + |
| 49 '<script type="text/javascript">some {{binding}} <div></div></script>'
+ | 49 '<script type="text/javascript">some {{binding}} <div></div></script>'
+ |
| 50 '<script type="text/ng-template" id="/some">other {{binding}} <div></d
iv></script>' + | 50 '<script type="text/ng-template" id="/some">other {{binding}} <div></d
iv></script>' + |
| 51 '</div>'], | 51 '</div>'], |
| 52 (Injector injector, Compiler compiler, TemplateCache templateCache, Scope
scope, DirectiveMap directives) { | 52 (Injector injector, Compiler compiler, TemplateCache templateCache, Scope
scope) { |
| 53 var templates = element.contents(); | 53 var templates = element.contents(); |
| 54 compiler(element, directives)(injector, element); | 54 compiler(element)(injector, element); |
| 55 | 55 |
| 56 microLeap(); | 56 microLeap(); |
| 57 // This binding should have been left alone (i.e. not interpolated). | 57 // This binding should have been left alone (i.e. not interpolated). |
| 58 expect(templates[2].innerHtml).toEqual('other {{binding}} <div></div>'); | 58 expect(templates[2].innerHtml).toEqual('other {{binding}} <div></div>'); |
| 59 } | 59 } |
| 60 ); | 60 ); |
| 61 }); | 61 }); |
| 62 } | 62 } |
| OLD | NEW |