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

Side by Side Diff: pkg/polymer/test/build/script_compactor_test.dart

Issue 27903006: Improves how to initialize polymer apps and fixes polymer build and linter to (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library polymer.test.build.script_compactor_test; 5 library polymer.test.build.script_compactor_test;
6 6
7 import 'package:polymer/src/build/common.dart'; 7 import 'package:polymer/src/build/common.dart';
8 import 'package:polymer/src/build/script_compactor.dart'; 8 import 'package:polymer/src/build/script_compactor.dart';
9 import 'package:unittest/compact_vm_config.dart'; 9 import 'package:unittest/compact_vm_config.dart';
10 10
11 import 'common.dart'; 11 import 'common.dart';
12 12
13 void main() { 13 void main() {
14 useCompactVMConfiguration(); 14 useCompactVMConfiguration();
15 var phases = [[new ScriptCompactor(new TransformOptions())]]; 15 var phases = [[new ScriptCompactor(new TransformOptions())]];
16 16
17 testPhases('no changes', phases, { 17 testPhases('no changes', phases, {
18 'a|web/test.html': '<!DOCTYPE html><html></html>', 18 'a|web/test.html': '<!DOCTYPE html><html></html>',
19 'a|web/test.html.scriptUrls': '[]',
19 }, { 20 }, {
20 'a|web/test.html': '<!DOCTYPE html><html></html>', 21 'a|web/test.html': '<!DOCTYPE html><html></html>',
21 }); 22 });
22 23
23 testPhases('no changes outside web/', phases, { 24 testPhases('no changes outside web/', phases, {
24 'a|lib/test.html': 25 'a|lib/test.html':
25 '<!DOCTYPE html><html><head>' 26 '<!DOCTYPE html><html><head>'
26 '<script type="application/dart" src="a.dart"></script>', 27 '<script type="application/dart" src="a.dart"></script>',
27 }, { 28 }, {
28 'a|lib/test.html': 29 'a|lib/test.html':
29 '<!DOCTYPE html><html><head>' 30 '<!DOCTYPE html><html><head>'
30 '<script type="application/dart" src="a.dart"></script>', 31 '<script type="application/dart" src="a.dart"></script>',
31 }); 32 });
32 33
33 testPhases('single script', phases, { 34 testPhases('single script', phases, {
34 'a|web/test.html': 35 'a|web/test.html':
35 '<!DOCTYPE html><html><head>' 36 '<!DOCTYPE html><html><head>'
36 '<script type="application/dart" src="a.dart"></script>', 37 '<script type="application/dart" src="a.dart"></script>',
38 'a|web/test.html.scriptUrls': '[]',
37 }, { 39 }, {
38 'a|web/test.html': 40 'a|web/test.html':
39 '<!DOCTYPE html><html><head></head><body>' 41 '<!DOCTYPE html><html><head>'
40 '<script type="application/dart" ' 42 '<script type="application/dart" '
41 'src="test.html_bootstrap.dart"></script>' 43 'src="test.html_bootstrap.dart"></script>'
42 '<script src="packages/browser/dart.js"></script>' 44 '</head><body></body></html>',
43 '</body></html>',
44 45
45 'a|web/test.html_bootstrap.dart': 46 'a|web/test.html_bootstrap.dart':
46 '''$MAIN_HEADER 47 '''$MAIN_HEADER
47 import 'a.dart' as i0; 48 import 'a.dart' as i0;
48 49
49 void main() { 50 void main() {
50 initPolymer([ 51 configureForDeployment([
51 'a.dart', 52 'a.dart',
52 ]); 53 ]);
54 i0.main();
53 } 55 }
54 '''.replaceAll('\n ', '\n'), 56 '''.replaceAll('\n ', '\n'),
55 }); 57 });
56 58
57 testPhases('several scripts', phases, { 59 testPhases('several scripts', phases, {
58 'a|web/test.html': 60 'a|web/test.html':
59 '<!DOCTYPE html><html><head>' 61 '<!DOCTYPE html><html><head>'
60 '<script type="application/dart" src="a.dart"></script>'
61 '<script type="application/dart" src="b.dart"></script>'
62 '</head><body><div>' 62 '</head><body><div>'
63 '<script type="application/dart" src="c.dart"></script>' 63 '<script type="application/dart" src="d.dart"></script>'
64 '</div>' 64 '</div>',
65 '<script type="application/dart" src="d.dart"></script>', 65 'a|web/test.html.scriptUrls':
66 '[["a", "web/a.dart"],["a", "web/b.dart"],["a", "web/c.dart"]]',
66 }, { 67 }, {
67 'a|web/test.html': 68 'a|web/test.html':
68 '<!DOCTYPE html><html><head></head><body><div></div>' 69 '<!DOCTYPE html><html><head></head><body><div>'
69 '<script type="application/dart" ' 70 '<script type="application/dart" src="test.html_bootstrap.dart">'
70 'src="test.html_bootstrap.dart"></script>' 71 '</script>'
71 '<script src="packages/browser/dart.js"></script>' 72 '</div>'
72 '</body></html>', 73 '</body></html>',
73 74
74 'a|web/test.html_bootstrap.dart': 75 'a|web/test.html_bootstrap.dart':
75 '''$MAIN_HEADER 76 '''$MAIN_HEADER
76 import 'a.dart' as i0; 77 import 'a.dart' as i0;
77 import 'b.dart' as i1; 78 import 'b.dart' as i1;
78 import 'c.dart' as i2; 79 import 'c.dart' as i2;
79 import 'd.dart' as i3; 80 import 'd.dart' as i3;
80 81
81 void main() { 82 void main() {
82 initPolymer([ 83 configureForDeployment([
83 'a.dart', 84 'a.dart',
84 'b.dart', 85 'b.dart',
85 'c.dart', 86 'c.dart',
86 'd.dart', 87 'd.dart',
87 ]); 88 ]);
89 i3.main();
88 } 90 }
89 '''.replaceAll('\n ', '\n'), 91 '''.replaceAll('\n ', '\n'),
90 }); 92 });
91 } 93 }
OLDNEW
« no previous file with comments | « pkg/polymer/test/build/polyfill_injector_test.dart ('k') | pkg/polymer/test/event_path_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698