Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(451)

Side by Side Diff: third_party/pkg/angular/test/directive/ng_template_spec.dart

Issue 257423008: Update all Angular libs (run update_all.sh). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 beforeEach((TestBed tb) => _ = tb);
11
10 they(should, htmlForElements, callback) { 12 they(should, htmlForElements, callback) {
11 htmlForElements.forEach((html) { 13 htmlForElements.forEach((html) {
12 var tagName = html.contains('<template') ? 'template' : 'script'; 14 var tagName = html.contains('<template') ? 'template' : 'script';
13 describe('$tagName[type="text/ng-template"]', () { 15 describe('$tagName[type="text/ng-template"]', () {
14 beforeEach(inject((TestBed tb) => _ = tb)); 16 beforeEach(() => element = e(html));
15 it(should, () { 17 it(should, callback);
16 element = $(html);
17 inject(callback);
18 });
19 }); 18 });
20 }); 19 });
21 } 20 }
22 21
23 they('should populate TemplateCache with contents of a ng-template template element', 22 they('should populate TemplateCache with contents of a ng-template template element',
24 [ // <template> 23 [ // <template>
25 '<div>foo' + 24 '<div>foo' +
26 '<template id="/ignore">ignore me</template>' + 25 '<template id="/ignore">ignore me</template>' +
27 '<template type="text/ng-template" id="/myTemplate.html"><x>{{y}}</x>< /template>' + 26 '<template type="text/ng-template" id="/myTemplate.html"><x>{{y}}</x>< /template>' +
28 '</div>', 27 '</div>',
29 // <script> 28 // <script>
30 '<div>foo' + 29 '<div>foo' +
31 '<script id="/ignore">ignore me</script>' + 30 '<script id="/ignore">ignore me</script>' +
32 '<script type="text/ng-template" id="/myTemplate.html"><x>{{y}}</x></s cript>' + 31 '<script type="text/ng-template" id="/myTemplate.html"><x>{{y}}</x></s cript>' +
33 '</div>'], 32 '</div>'],
34 (Injector injector, Compiler compiler, TemplateCache templateCache, Direct iveMap directives) { 33 (TemplateCache templateCache) {
35 compiler(element, directives)(injector, element); 34 _.compile(element);
36 expect(templateCache.get('/ignore')).toBeNull(); 35 expect(templateCache.get('/ignore')).toBeNull();
37 expect(templateCache.get('/myTemplate.html').responseText).toEqual('<x>{ {y}}</x>'); 36 expect(templateCache.get('/myTemplate.html').responseText).toEqual('<x>{ {y}}</x>');
38 } 37 }
39 ); 38 );
40 39
41 they('should not compile template elements', 40 it('should not compile template elements', () {
42 [ // <template> 41 _.compile(element = e('<div>foo'
43 '<div>foo' + 42 '<template type="text/javascript">some {{binding}} <div></div></templa te>'
44 '<template type="text/javascript">some {{binding}} <div></div></templa te>' + 43 '<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>' + 44 '</div>'));
46 '</div>',
47 // <script>
48 '<div>foo' +
49 '<script type="text/javascript">some {{binding}} <div></div></script>' +
50 '<script type="text/ng-template" id="/some">other {{binding}} <div></d iv></script>' +
51 '</div>'],
52 (Injector injector, Compiler compiler, TemplateCache templateCache, Scope scope, DirectiveMap directives) {
53 var templates = element.contents();
54 compiler(element, directives)(injector, element);
55 45
56 microLeap(); 46 microLeap();
57 // This binding should have been left alone (i.e. not interpolated). 47
58 expect(templates[2].innerHtml).toEqual('other {{binding}} <div></div>'); 48 expect(element.children[1] is TemplateElement).toBeTruthy();
59 } 49 // This binding should have been left alone (i.e. not interpolated).
60 ); 50 expect(element.children[1].content).toHaveHtml('other {{binding}} <div></d iv>');
51 });
52
53 it('should not compile script elements', () {
54 _.compile(element = e('<div>foo'
55 '<script type="text/javascript">some {{binding}} <div></div></script>'
56 '<script type="text/ng-template" id="/some">other {{binding}} <div></d iv></script>'
57 '</div>'));
58
59 microLeap();
60
61 // This binding should have been left alone (i.e. not interpolated).
62 expect(element.children[1]).toHaveHtml('other {{binding}} <div></div>');
63 });
61 }); 64 });
62 } 65 }
OLDNEW
« no previous file with comments | « third_party/pkg/angular/test/directive/ng_switch_spec.dart ('k') | third_party/pkg/angular/test/filter/currency_spec.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698