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

Side by Side Diff: third_party/pkg/angular/test/io/expression_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.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 main() => describe('expression_extractor', () { 14 void main() {
15 it('should extract all expressions from source and templates', () { 15 describe('expression_extractor', () {
16 Module module = new Module();
17 16
18 Injector injector = new DynamicInjector(modules: [module], 17 Iterable<String> _extractExpressions(file) {
19 allowImplicitInjection: true); 18 Module module = new Module();
19 Injector injector = new DynamicInjector(modules: [module],
20 allowImplicitInjection: true);
20 21
21 IoService ioService = new IoServiceImpl(); 22 IoService ioService = new IoServiceImpl();
22 var sourceCrawler = new SourceCrawlerImpl(['packages/']); 23 var sourceCrawler = new SourceCrawlerImpl(['packages/']);
23 var sourceMetadataExtractor = new SourceMetadataExtractor(); 24 var sourceMetadataExtractor = new SourceMetadataExtractor();
24 List<DirectiveInfo> directives = 25 List<DirectiveInfo> directives =
25 sourceMetadataExtractor 26 sourceMetadataExtractor
26 .gatherDirectiveInfo('test/io/test_files/main.dart', sourceCrawler); 27 .gatherDirectiveInfo(file, sourceCrawler);
27 var htmlExtractor = new HtmlExpressionExtractor(directives); 28 var htmlExtractor = new HtmlExpressionExtractor(directives);
28 htmlExtractor.crawl('test/io/test_files/', ioService); 29 htmlExtractor.crawl('test/io/test_files/', ioService);
29 30
30 var expressions = htmlExtractor.expressions; 31 return htmlExtractor.expressions;
31 expect(expressions, unorderedEquals([ 32 }
32 'ctrl.expr', 33
33 'ctrl.anotherExpression', 34 it('should extract all expressions from source and templates', () {
34 'ctrl.callback', 35 var expressions = _extractExpressions('test/io/test_files/main.dart');
35 'ctrl.twoWayStuff', 36
36 'attr', 37 expect(expressions, unorderedEquals([
37 'expr', 38 'ctrl.expr',
38 'anotherExpression', 39 'ctrl.anotherExpression',
39 'callback', 40 'ctrl.callback',
40 'twoWayStuff', 41 'ctrl.twoWayStuff',
41 'exported + expression', 42 'attr',
42 'ctrl.inline.template.expression', 43 'expr',
43 'ngIfCondition', 44 'anotherExpression',
44 'ctrl.if' 45 'callback',
45 ])); 46 'twoWayStuff',
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 });
46 }); 59 });
47 }); 60 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698