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

Side by Side Diff: third_party/pkg/angular/test/io/template_cache_generator_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.template_cache_generator_spec; 1 library ng.tool.template_cache_generator_spec;
2 2
3 import 'dart:async'; 3 import 'dart:async';
4 import 'dart:io'; 4 import 'dart:io';
5 5
6 import 'package:angular/tools/template_cache_generator.dart' as generator; 6 import 'package:angular/tools/template_cache_generator.dart' as generator;
7 import '../jasmine_syntax.dart'; 7 import '../jasmine_syntax.dart';
8 import 'package:unittest/unittest.dart'; 8 import 'package:unittest/unittest.dart';
9 9
10 main() => describe('template_cache_generator', () { 10 void main() {
11 describe('template_cache_generator', () {
11 12
12 it('should correctly generate the templates cache file (template)', () { 13 it('should correctly generate the templates cache file (template)', () {
13 var tmpDir = Directory.systemTemp.createTempSync(); 14 var tmpDir = Directory.systemTemp.createTempSync();
14 Future flush; 15 Future flush;
15 try { 16 try {
16 flush = generator.main(['test/io/test_files/templates/main.dart', 17 flush = generator.main([
17 Platform.environment['DART_SDK'], 18 '--out=${tmpDir.path}/generated.dart',
18 '${tmpDir.path}/generated.dart', 'generated', 19 '--url-rewrites=/test/io/test_files,rewritten',
19 '%SYSTEM_PACKAGE_ROOT%', 20 '--skip-classes=MyComponent3',
20 '/test/io/test_files,rewritten', 'MyComponent3']); 21 'test/io/test_files/templates/main.dart',
21 } catch(_) { 22 'generated']);
22 tmpDir.deleteSync(recursive: true); 23 } catch(_) {
23 rethrow; 24 tmpDir.deleteSync(recursive: true);
24 } 25 rethrow;
25 return flush.then((_) { 26 }
26 expect(new File('${tmpDir.path}/generated.dart').readAsStringSync(), 27 return flush.then((_) {
27 '// GENERATED, DO NOT EDIT!\n' 28 expect(new File('${tmpDir.path}/generated.dart').readAsStringSync(),
28 'library generated;\n' 29 '// GENERATED, DO NOT EDIT!\n'
29 '\n' 30 'library generated;\n'
30 'import \'package:angular/angular.dart\';\n' 31 '\n'
31 '\n' 32 'import \'package:angular/angular.dart\';\n'
32 'primeTemplateCache(TemplateCache tc) {\n' 33 '\n'
33 'tc.put("rewritten/templates/main.html", new HttpResponse(200, r"""Hel lo World!"""));\n' 34 'primeTemplateCache(TemplateCache tc) {\n'
34 '}'); 35 'tc.put("rewritten/templates/main.html", new HttpResponse(200, r"""H ello World!"""));\n'
35 }).whenComplete(() { 36 '}');
36 tmpDir.deleteSync(recursive: true); 37 }).whenComplete(() {
38 tmpDir.deleteSync(recursive: true);
39 });
37 }); 40 });
38 });
39 41
40 it('should correctly generate the templates cache file (css)', () { 42 it('should correctly generate the templates cache file (css)', () {
41 var tmpDir = Directory.systemTemp.createTempSync(); 43 var tmpDir = Directory.systemTemp.createTempSync();
42 Future flush; 44 Future flush;
43 try { 45 try {
44 flush = generator.main(['test/io/test_files/cssUrls/main.dart', 46 flush = generator.main([
45 Platform.environment['DART_SDK'], 47 '--out=${tmpDir.path}/generated.dart',
46 '${tmpDir.path}/generated.dart', 'generated', 48 '--url-rewrites=/test/io/test_files,rewritten',
47 '%SYSTEM_PACKAGE_ROOT%', 49 '--skip-classes=MyComponent3',
48 '/test/io/test_files,rewritten', 'MyComponent3']); 50 'test/io/test_files/cssUrls/main.dart',
49 } catch(_) { 51 'generated']);
50 tmpDir.deleteSync(recursive: true); 52 } catch(_) {
51 rethrow; 53 tmpDir.deleteSync(recursive: true);
52 } 54 rethrow;
53 return flush.then((_) { 55 }
54 expect(new File('${tmpDir.path}/generated.dart').readAsStringSync(), 56 return flush.then((_) {
55 '// GENERATED, DO NOT EDIT!\n' 57 expect(new File('${tmpDir.path}/generated.dart').readAsStringSync(),
56 'library generated;\n' 58 '// GENERATED, DO NOT EDIT!\n'
57 '\n' 59 'library generated;\n'
58 'import \'package:angular/angular.dart\';\n' 60 '\n'
59 '\n' 61 'import \'package:angular/angular.dart\';\n'
60 'primeTemplateCache(TemplateCache tc) {\n' 62 '\n'
61 'tc.put("rewritten/cssUrls/one.css", new HttpResponse(200, r"""body {}""") );\n' 63 'primeTemplateCache(TemplateCache tc) {\n'
62 'tc.put("rewritten/cssUrls/three.css", new HttpResponse(200, r"""body {}"" "));\n' 64 'tc.put("rewritten/cssUrls/one.css", new HttpResponse(200, r"""body {}"""));\n'
63 'tc.put("rewritten/cssUrls/two.css", new HttpResponse(200, r"""body {}""") );\n' 65 'tc.put("rewritten/cssUrls/three.css", new HttpResponse(200, r"""bod y {}"""));\n'
64 '}'); 66 'tc.put("rewritten/cssUrls/two.css", new HttpResponse(200, r"""body {}"""));\n'
65 }).whenComplete(() { 67 '}');
66 //tmpDir.deleteSync(recursive: true); 68 }).whenComplete(() {
69 tmpDir.deleteSync(recursive: true);
70 });
67 }); 71 });
68 });
69 72
70 73
71 }); 74 });
75 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698