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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/pkg/angular/test/directive/ng_template_spec.dart
diff --git a/third_party/pkg/angular/test/directive/ng_template_spec.dart b/third_party/pkg/angular/test/directive/ng_template_spec.dart
index 4f39f9c69d6136d349482e03080a0fdc820bc191..7811bd4328576f5309d01ac4809e69568a6e5d2c 100644
--- a/third_party/pkg/angular/test/directive/ng_template_spec.dart
+++ b/third_party/pkg/angular/test/directive/ng_template_spec.dart
@@ -7,15 +7,14 @@ main() {
TestBed _;
var element;
+ beforeEach((TestBed tb) => _ = tb);
+
they(should, htmlForElements, callback) {
htmlForElements.forEach((html) {
var tagName = html.contains('<template') ? 'template' : 'script';
describe('$tagName[type="text/ng-template"]', () {
- beforeEach(inject((TestBed tb) => _ = tb));
- it(should, () {
- element = $(html);
- inject(callback);
- });
+ beforeEach(() => element = e(html));
+ it(should, callback);
});
});
}
@@ -31,32 +30,36 @@ main() {
'<script id="/ignore">ignore me</script>' +
'<script type="text/ng-template" id="/myTemplate.html"><x>{{y}}</x></script>' +
'</div>'],
- (Injector injector, Compiler compiler, TemplateCache templateCache, DirectiveMap directives) {
- compiler(element, directives)(injector, element);
+ (TemplateCache templateCache) {
+ _.compile(element);
expect(templateCache.get('/ignore')).toBeNull();
expect(templateCache.get('/myTemplate.html').responseText).toEqual('<x>{{y}}</x>');
}
);
- they('should not compile template elements',
- [ // <template>
- '<div>foo' +
- '<template type="text/javascript">some {{binding}} <div></div></template>' +
- '<template type="text/ng-template" id="/some">other {{binding}} <div></div></template>' +
- '</div>',
- // <script>
- '<div>foo' +
- '<script type="text/javascript">some {{binding}} <div></div></script>' +
- '<script type="text/ng-template" id="/some">other {{binding}} <div></div></script>' +
- '</div>'],
- (Injector injector, Compiler compiler, TemplateCache templateCache, Scope scope, DirectiveMap directives) {
- var templates = element.contents();
- compiler(element, directives)(injector, element);
+ it('should not compile template elements', () {
+ _.compile(element = e('<div>foo'
+ '<template type="text/javascript">some {{binding}} <div></div></template>'
+ '<template type="text/ng-template" id="/some">other {{binding}} <div></div></template>'
+ '</div>'));
- microLeap();
- // This binding should have been left alone (i.e. not interpolated).
- expect(templates[2].innerHtml).toEqual('other {{binding}} <div></div>');
- }
- );
+ microLeap();
+
+ expect(element.children[1] is TemplateElement).toBeTruthy();
+ // This binding should have been left alone (i.e. not interpolated).
+ expect(element.children[1].content).toHaveHtml('other {{binding}} <div></div>');
+ });
+
+ it('should not compile script elements', () {
+ _.compile(element = e('<div>foo'
+ '<script type="text/javascript">some {{binding}} <div></div></script>'
+ '<script type="text/ng-template" id="/some">other {{binding}} <div></div></script>'
+ '</div>'));
+
+ microLeap();
+
+ // This binding should have been left alone (i.e. not interpolated).
+ expect(element.children[1]).toHaveHtml('other {{binding}} <div></div>');
+ });
});
}
« 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