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

Side by Side Diff: third_party/pkg/angular/test/io/source_metadata_extractor_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.tool.source_metadata_extractor_spec; 1 library ng.tool.source_metadata_extractor_spec;
2 2
3 import 'package:angular/tools/common.dart'; 3 import 'package:angular/tools/common.dart';
4 import 'package:angular/tools/source_crawler_impl.dart'; 4 import 'package:angular/tools/source_crawler_impl.dart';
5 import 'package:angular/tools/source_metadata_extractor.dart'; 5 import 'package:angular/tools/source_metadata_extractor.dart';
6 import '../jasmine_syntax.dart'; 6 import '../jasmine_syntax.dart';
7 import 'package:unittest/unittest.dart'; 7 import 'package:unittest/unittest.dart';
8 8
9 main() => describe('source_metadata_extractor', () { 9 void main() {
10 it('should extract all attribute mappings including annotations', () { 10 describe('source_metadata_extractor', () {
11 var sourceCrawler = new SourceCrawlerImpl(['packages/']); 11 it('should extract all attribute mappings including annotations', () {
12 var sourceMetadataExtractor = new SourceMetadataExtractor(); 12 var sourceCrawler = new SourceCrawlerImpl(['packages/']);
13 List<DirectiveInfo> directives = 13 var sourceMetadataExtractor = new SourceMetadataExtractor();
14 sourceMetadataExtractor 14 List<DirectiveInfo> directives = sourceMetadataExtractor
15 .gatherDirectiveInfo('test/io/test_files/main.dart', sourceCrawler); 15 .gatherDirectiveInfo('test/io/test_files/main.dart', sourceCrawler);
16 16
17 expect(directives, hasLength(2)); 17 expect(directives.map((d) => d.selector),
18 unorderedEquals(['[ng-if]', 'my-component']));
18 19
19 DirectiveInfo info = directives.elementAt(1); 20 DirectiveInfo info = directives.elementAt(1);
20 expect(info.expressionAttrs, unorderedEquals(['expr', 'another-expression', 21 expect(info.expressionAttrs, unorderedEquals(['expr', 'another-expression' ,
21 'callback', 'two-way-stuff', 'exported-attr'])); 22 'callback', 'two-way-stuff', 'exported-attr']));
22 expect(info.expressions, unorderedEquals(['attr', 'expr', 23 expect(info.expressions, unorderedEquals(['attr', 'expr',
23 'anotherExpression', 'callback', 'twoWayStuff', 24 'anotherExpression', 'callback', 'twoWayStuff', 'exported + expression ']));
24 'exported + expression'])); 25 });
26
27 it('should extract ngRoute templates from ngRoute viewHtml', () {
28 var sourceCrawler = new SourceCrawlerImpl(['packages/']);
29 var sourceMetadataExtractor = new SourceMetadataExtractor();
30 List<DirectiveInfo> directives = sourceMetadataExtractor
31 .gatherDirectiveInfo('test/io/test_files/routing.dart', sourceCrawler) ;
32
33 var templates = directives
34 .where((i) => i.selector == null)
35 .map((i) => i.template);
36 expect(templates, hasLength(2));
37 expect(templates,
38 unorderedEquals(['<div ng-if="foo"></div>', '<div ng-if="bar"></div>'] ));
39 });
25 }); 40 });
26 }); 41 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698