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

Side by Side Diff: third_party/pkg/angular/test/io/expression_extractor_spec.dart

Issue 256553002: Revert "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.expression_extractor_spec; 1 library ng.tool.expression_extractor_spec;
2 2
3 import 'package:di/di.dart'; 3 import 'package:di/di.dart';
4 import 'package:di/dynamic_injector.dart'; 4 import 'package:di/dynamic_injector.dart';
5 import 'package:angular/tools/common.dart'; 5 import 'package:angular/tools/common.dart';
6 import 'package:angular/tools/io.dart'; 6 import 'package:angular/tools/io.dart';
7 import 'package:angular/tools/io_impl.dart'; 7 import 'package:angular/tools/io_impl.dart';
8 import 'package:angular/tools/source_crawler_impl.dart'; 8 import 'package:angular/tools/source_crawler_impl.dart';
9 import 'package:angular/tools/html_extractor.dart'; 9 import 'package:angular/tools/html_extractor.dart';
10 import 'package:angular/tools/source_metadata_extractor.dart'; 10 import 'package:angular/tools/source_metadata_extractor.dart';
11 import '../jasmine_syntax.dart'; 11 import '../jasmine_syntax.dart';
12 import 'package:unittest/unittest.dart'; 12 import 'package:unittest/unittest.dart';
13 13
14 void main() { 14 main() => describe('expression_extractor', () {
15 describe('expression_extractor', () { 15 it('should extract all expressions from source and templates', () {
16 Module module = new Module();
16 17
17 Iterable<String> _extractExpressions(file) { 18 Injector injector = new DynamicInjector(modules: [module],
18 Module module = new Module(); 19 allowImplicitInjection: true);
19 Injector injector = new DynamicInjector(modules: [module],
20 allowImplicitInjection: true);
21 20
22 IoService ioService = new IoServiceImpl(); 21 IoService ioService = new IoServiceImpl();
23 var sourceCrawler = new SourceCrawlerImpl(['packages/']); 22 var sourceCrawler = new SourceCrawlerImpl(['packages/']);
24 var sourceMetadataExtractor = new SourceMetadataExtractor(); 23 var sourceMetadataExtractor = new SourceMetadataExtractor();
25 List<DirectiveInfo> directives = 24 List<DirectiveInfo> directives =
26 sourceMetadataExtractor 25 sourceMetadataExtractor
27 .gatherDirectiveInfo(file, sourceCrawler); 26 .gatherDirectiveInfo('test/io/test_files/main.dart', sourceCrawler);
28 var htmlExtractor = new HtmlExpressionExtractor(directives); 27 var htmlExtractor = new HtmlExpressionExtractor(directives);
29 htmlExtractor.crawl('test/io/test_files/', ioService); 28 htmlExtractor.crawl('test/io/test_files/', ioService);
30 29
31 return htmlExtractor.expressions; 30 var expressions = htmlExtractor.expressions;
32 } 31 expect(expressions, unorderedEquals([
33 32 'ctrl.expr',
34 it('should extract all expressions from source and templates', () { 33 'ctrl.anotherExpression',
35 var expressions = _extractExpressions('test/io/test_files/main.dart'); 34 'ctrl.callback',
36 35 'ctrl.twoWayStuff',
37 expect(expressions, unorderedEquals([ 36 'attr',
38 'ctrl.expr', 37 'expr',
39 'ctrl.anotherExpression', 38 'anotherExpression',
40 'ctrl.callback', 39 'callback',
41 'ctrl.twoWayStuff', 40 'twoWayStuff',
42 'attr', 41 'exported + expression',
43 'expr', 42 'ctrl.inline.template.expression',
44 'anotherExpression', 43 'ngIfCondition',
45 'callback', 44 'ctrl.if'
46 'twoWayStuff', 45 ]));
47 'exported + expression',
48 'ctrl.inline.template.expression',
49 'ngIfCondition',
50 'ctrl.if'
51 ]));
52 });
53
54 it('should extract expressions from ngRoute viewHtml', () {
55 var expressions = _extractExpressions('test/io/test_files/routing.dart');
56 expect(expressions, contains('foo'));
57 expect(expressions, contains('bar'));
58 });
59 }); 46 });
60 } 47 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698