Index: third_party/pkg/angular/test/io/expression_extractor_spec.dart |
diff --git a/third_party/pkg/angular/test/io/expression_extractor_spec.dart b/third_party/pkg/angular/test/io/expression_extractor_spec.dart |
index 5ecc402d6f33d1c92f7a4ec439823db26236fa36..cf04340a379f8500c4c8d5efb6aed3ff0cbc3db2 100644 |
--- a/third_party/pkg/angular/test/io/expression_extractor_spec.dart |
+++ b/third_party/pkg/angular/test/io/expression_extractor_spec.dart |
@@ -11,37 +11,50 @@ import 'package:angular/tools/source_metadata_extractor.dart'; |
import '../jasmine_syntax.dart'; |
import 'package:unittest/unittest.dart'; |
-main() => describe('expression_extractor', () { |
- it('should extract all expressions from source and templates', () { |
- Module module = new Module(); |
- |
- Injector injector = new DynamicInjector(modules: [module], |
- allowImplicitInjection: true); |
- |
- IoService ioService = new IoServiceImpl(); |
- var sourceCrawler = new SourceCrawlerImpl(['packages/']); |
- var sourceMetadataExtractor = new SourceMetadataExtractor(); |
- List<DirectiveInfo> directives = |
- sourceMetadataExtractor |
- .gatherDirectiveInfo('test/io/test_files/main.dart', sourceCrawler); |
- var htmlExtractor = new HtmlExpressionExtractor(directives); |
- htmlExtractor.crawl('test/io/test_files/', ioService); |
- |
- var expressions = htmlExtractor.expressions; |
- expect(expressions, unorderedEquals([ |
- 'ctrl.expr', |
- 'ctrl.anotherExpression', |
- 'ctrl.callback', |
- 'ctrl.twoWayStuff', |
- 'attr', |
- 'expr', |
- 'anotherExpression', |
- 'callback', |
- 'twoWayStuff', |
- 'exported + expression', |
- 'ctrl.inline.template.expression', |
- 'ngIfCondition', |
- 'ctrl.if' |
- ])); |
+void main() { |
+ describe('expression_extractor', () { |
+ |
+ Iterable<String> _extractExpressions(file) { |
+ Module module = new Module(); |
+ Injector injector = new DynamicInjector(modules: [module], |
+ allowImplicitInjection: true); |
+ |
+ IoService ioService = new IoServiceImpl(); |
+ var sourceCrawler = new SourceCrawlerImpl(['packages/']); |
+ var sourceMetadataExtractor = new SourceMetadataExtractor(); |
+ List<DirectiveInfo> directives = |
+ sourceMetadataExtractor |
+ .gatherDirectiveInfo(file, sourceCrawler); |
+ var htmlExtractor = new HtmlExpressionExtractor(directives); |
+ htmlExtractor.crawl('test/io/test_files/', ioService); |
+ |
+ return htmlExtractor.expressions; |
+ } |
+ |
+ it('should extract all expressions from source and templates', () { |
+ var expressions = _extractExpressions('test/io/test_files/main.dart'); |
+ |
+ expect(expressions, unorderedEquals([ |
+ 'ctrl.expr', |
+ 'ctrl.anotherExpression', |
+ 'ctrl.callback', |
+ 'ctrl.twoWayStuff', |
+ 'attr', |
+ 'expr', |
+ 'anotherExpression', |
+ 'callback', |
+ 'twoWayStuff', |
+ 'exported + expression', |
+ 'ctrl.inline.template.expression', |
+ 'ngIfCondition', |
+ 'ctrl.if' |
+ ])); |
+ }); |
+ |
+ it('should extract expressions from ngRoute viewHtml', () { |
+ var expressions = _extractExpressions('test/io/test_files/routing.dart'); |
+ expect(expressions, contains('foo')); |
+ expect(expressions, contains('bar')); |
+ }); |
}); |
-}); |
+} |