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

Side by Side Diff: pkg/polymer/test/transform/import_inliner_test.dart

Issue 23757034: Rearranges the polymer package now that the old compiler is gone. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library polymer.test.transform.import_inliner_test;
6
7 import 'package:polymer/src/transform/common.dart';
8 import 'package:polymer/src/transform/import_inliner.dart';
9 import 'package:unittest/compact_vm_config.dart';
10 import 'package:unittest/unittest.dart';
11
12 import 'common.dart';
13
14 void main() {
15 useCompactVMConfiguration();
16 var phases = [[new ImportedElementInliner(new TransformOptions())]];
17 testPhases('no changes', phases, {
18 'a|web/test.html': '<!DOCTYPE html><html></html>',
19 }, {
20 'a|web/test.html': '<!DOCTYPE html><html></html>',
21 });
22
23 testPhases('empty import', phases, {
24 'a|web/test.html':
25 '<!DOCTYPE html><html><head>'
26 '<link rel="import" href="">' // empty href
27 '</head></html>',
28 'a|web/test2.html':
29 '<!DOCTYPE html><html><head>'
30 '<link rel="import">' // no href
31 '</head></html>',
32 }, {
33 'a|web/test.html':
34 '<!DOCTYPE html><html><head>'
35 '</head><body></body></html>',
36 'a|web/test2.html':
37 '<!DOCTYPE html><html><head>'
38 '</head><body></body></html>',
39 });
40
41 testPhases('shallow, no elements', phases, {
42 'a|web/test.html':
43 '<!DOCTYPE html><html><head>'
44 '<link rel="import" href="test2.html">'
45 '</head></html>',
46 'a|web/test2.html':
47 '<!DOCTYPE html><html><head>'
48 '</head></html>',
49 }, {
50 'a|web/test.html':
51 '<!DOCTYPE html><html><head>'
52 '</head><body></body></html>',
53 'a|web/test2.html':
54 '<!DOCTYPE html><html><head>'
55 '</head></html>',
56 });
57
58 testPhases('shallow, elements, one import', phases,
59 {
60 'a|web/test.html':
61 '<!DOCTYPE html><html><head>'
62 '<link rel="import" href="test2.html">'
63 '</head></html>',
64 'a|web/test2.html':
65 '<!DOCTYPE html><html><head>'
66 '</head><body><polymer-element>2</polymer-element></html>',
67 }, {
68 'a|web/test.html':
69 '<!DOCTYPE html><html><head>'
70 '</head><body>'
71 '<polymer-element>2</polymer-element>'
72 '</body></html>',
73 'a|web/test2.html':
74 '<!DOCTYPE html><html><head>'
75 '</head><body><polymer-element>2</polymer-element></html>',
76 });
77
78 testPhases('no transformation outside web/', phases,
79 {
80 'a|lib/test.html':
81 '<!DOCTYPE html><html><head>'
82 '<link rel="import" href="test2.html">'
83 '</head></html>',
84 'a|lib/test2.html':
85 '<!DOCTYPE html><html><head>'
86 '</head><body><polymer-element>2</polymer-element></html>',
87 }, {
88 'a|lib/test.html':
89 '<!DOCTYPE html><html><head>'
90 '<link rel="import" href="test2.html">'
91 '</head></html>',
92 'a|lib/test2.html':
93 '<!DOCTYPE html><html><head>'
94 '</head><body><polymer-element>2</polymer-element></html>',
95 });
96
97 testPhases('shallow, elements, many', phases,
98 {
99 'a|web/test.html':
100 '<!DOCTYPE html><html><head>'
101 '<link rel="import" href="test2.html">'
102 '<link rel="import" href="test3.html">'
103 '</head></html>',
104 'a|web/test2.html':
105 '<!DOCTYPE html><html><head>'
106 '</head><body><polymer-element>2</polymer-element></html>',
107 'a|web/test3.html':
108 '<!DOCTYPE html><html><head>'
109 '</head><body><polymer-element>3</polymer-element></html>',
110 }, {
111 'a|web/test.html':
112 '<!DOCTYPE html><html><head>'
113 '</head><body>'
114 '<polymer-element>2</polymer-element>'
115 '<polymer-element>3</polymer-element>'
116 '</body></html>',
117 'a|web/test2.html':
118 '<!DOCTYPE html><html><head>'
119 '</head><body><polymer-element>2</polymer-element></html>',
120 'a|web/test3.html':
121 '<!DOCTYPE html><html><head>'
122 '</head><body><polymer-element>3</polymer-element></html>',
123 });
124
125 testPhases('deep, elements, one per file', phases, {
126 'a|web/test.html':
127 '<!DOCTYPE html><html><head>'
128 '<link rel="import" href="test2.html">'
129 '</head></html>',
130 'a|web/test2.html':
131 '<!DOCTYPE html><html><head>'
132 '<link rel="import" href="assets/b/test3.html">'
133 '</head><body><polymer-element>2</polymer-element></html>',
134 'b|asset/test3.html':
135 '<!DOCTYPE html><html><head>'
136 '<link rel="import" href="packages/c/test4.html">'
137 '</head><body><polymer-element>3</polymer-element></html>',
138 'c|lib/test4.html':
139 '<!DOCTYPE html><html><head>'
140 '</head><body><polymer-element>4</polymer-element></html>',
141 }, {
142 'a|web/test.html':
143 '<!DOCTYPE html><html><head>'
144 '</head><body>'
145 '<polymer-element>4</polymer-element>'
146 '<polymer-element>3</polymer-element>'
147 '<polymer-element>2</polymer-element></body></html>',
148 'a|web/test2.html':
149 '<!DOCTYPE html><html><head>'
150 '</head><body>'
151 '<polymer-element>4</polymer-element>'
152 '<polymer-element>3</polymer-element>'
153 '<polymer-element>2</polymer-element></body></html>',
154 'b|asset/test3.html':
155 '<!DOCTYPE html><html><head>'
156 '<link rel="import" href="packages/c/test4.html">'
157 '</head><body><polymer-element>3</polymer-element></html>',
158 'c|lib/test4.html':
159 '<!DOCTYPE html><html><head>'
160 '</head><body><polymer-element>4</polymer-element></html>',
161 });
162
163 testPhases('deep, elements, many imports', phases, {
164 'a|web/test.html':
165 '<!DOCTYPE html><html><head>'
166 '<link rel="import" href="test2a.html">'
167 '<link rel="import" href="test2b.html">'
168 '</head></html>',
169 'a|web/test2a.html':
170 '<!DOCTYPE html><html><head>'
171 '<link rel="import" href="test3a.html">'
172 '<link rel="import" href="test3b.html">'
173 '</head><body><polymer-element>2a</polymer-element></body></html>',
174 'a|web/test2b.html':
175 '<!DOCTYPE html><html><head>'
176 '<link rel="import" href="test4a.html">'
177 '<link rel="import" href="test4b.html">'
178 '</head><body><polymer-element>2b</polymer-element></body></html>',
179 'a|web/test3a.html':
180 '<!DOCTYPE html><html><head>'
181 '</head><body><polymer-element>3a</polymer-element></body></html>',
182 'a|web/test3b.html':
183 '<!DOCTYPE html><html><head>'
184 '</head><body><polymer-element>3b</polymer-element></body></html>',
185 'a|web/test4a.html':
186 '<!DOCTYPE html><html><head>'
187 '</head><body><polymer-element>4a</polymer-element></body></html>',
188 'a|web/test4b.html':
189 '<!DOCTYPE html><html><head>'
190 '</head><body><polymer-element>4b</polymer-element></body></html>',
191 }, {
192 'a|web/test.html':
193 '<!DOCTYPE html><html><head>'
194 '</head><body>'
195 '<polymer-element>3a</polymer-element>'
196 '<polymer-element>3b</polymer-element>'
197 '<polymer-element>2a</polymer-element>'
198 '<polymer-element>4a</polymer-element>'
199 '<polymer-element>4b</polymer-element>'
200 '<polymer-element>2b</polymer-element>'
201 '</body></html>',
202 'a|web/test2a.html':
203 '<!DOCTYPE html><html><head>'
204 '</head><body>'
205 '<polymer-element>3a</polymer-element>'
206 '<polymer-element>3b</polymer-element>'
207 '<polymer-element>2a</polymer-element>'
208 '</body></html>',
209 'a|web/test2b.html':
210 '<!DOCTYPE html><html><head>'
211 '</head><body>'
212 '<polymer-element>4a</polymer-element>'
213 '<polymer-element>4b</polymer-element>'
214 '<polymer-element>2b</polymer-element>'
215 '</body></html>',
216 'a|web/test3a.html':
217 '<!DOCTYPE html><html><head>'
218 '</head><body>'
219 '<polymer-element>3a</polymer-element>'
220 '</body></html>',
221 'a|web/test3b.html':
222 '<!DOCTYPE html><html><head>'
223 '</head><body>'
224 '<polymer-element>3b</polymer-element>'
225 '</body></html>',
226 'a|web/test4a.html':
227 '<!DOCTYPE html><html><head>'
228 '</head><body>'
229 '<polymer-element>4a</polymer-element>'
230 '</body></html>',
231 'a|web/test4b.html':
232 '<!DOCTYPE html><html><head>'
233 '</head><body>'
234 '<polymer-element>4b</polymer-element>'
235 '</body></html>',
236 });
237
238 testPhases('imports cycle, 1-step lasso', phases, {
239 'a|web/test.html':
240 '<!DOCTYPE html><html><head>'
241 '<link rel="import" href="test_1.html">'
242 '</head></html>',
243 'a|web/test_1.html':
244 '<!DOCTYPE html><html><head>'
245 '<link rel="import" href="test_2.html">'
246 '</head><body><polymer-element>1</polymer-element></html>',
247 'a|web/test_2.html':
248 '<!DOCTYPE html><html><head>'
249 '<link rel="import" href="test_1.html">'
250 '</head><body><polymer-element>2</polymer-element></html>',
251 }, {
252 'a|web/test.html':
253 '<!DOCTYPE html><html><head>'
254 '</head><body>'
255 '<polymer-element>2</polymer-element>'
256 '<polymer-element>1</polymer-element></body></html>',
257 'a|web/test_1.html':
258 '<!DOCTYPE html><html><head>'
259 '</head><body>'
260 '<polymer-element>2</polymer-element>'
261 '<polymer-element>1</polymer-element></body></html>',
262 'a|web/test_2.html':
263 '<!DOCTYPE html><html><head>'
264 '</head><body>'
265 '<polymer-element>1</polymer-element>'
266 '<polymer-element>2</polymer-element></body></html>',
267 });
268
269 testPhases('imports cycle, 2-step lasso', phases, {
270 'a|web/test.html':
271 '<!DOCTYPE html><html><head>'
272 '<link rel="import" href="test_1.html">'
273 '</head></html>',
274 'a|web/test_1.html':
275 '<!DOCTYPE html><html><head>'
276 '<link rel="import" href="test_2.html">'
277 '</head><body><polymer-element>1</polymer-element></html>',
278 'a|web/test_2.html':
279 '<!DOCTYPE html><html><head>'
280 '<link rel="import" href="test_3.html">'
281 '</head><body><polymer-element>2</polymer-element></html>',
282 'a|web/test_3.html':
283 '<!DOCTYPE html><html><head>'
284 '<link rel="import" href="test_1.html">'
285 '</head><body><polymer-element>3</polymer-element></html>',
286 }, {
287 'a|web/test.html':
288 '<!DOCTYPE html><html><head>'
289 '</head><body>'
290 '<polymer-element>3</polymer-element>'
291 '<polymer-element>2</polymer-element>'
292 '<polymer-element>1</polymer-element></body></html>',
293 'a|web/test_1.html':
294 '<!DOCTYPE html><html><head>'
295 '</head><body>'
296 '<polymer-element>3</polymer-element>'
297 '<polymer-element>2</polymer-element>'
298 '<polymer-element>1</polymer-element></body></html>',
299 'a|web/test_2.html':
300 '<!DOCTYPE html><html><head>'
301 '</head><body>'
302 '<polymer-element>1</polymer-element>'
303 '<polymer-element>3</polymer-element>'
304 '<polymer-element>2</polymer-element></body></html>',
305 'a|web/test_3.html':
306 '<!DOCTYPE html><html><head>'
307 '</head><body>'
308 '<polymer-element>2</polymer-element>'
309 '<polymer-element>1</polymer-element>'
310 '<polymer-element>3</polymer-element></body></html>',
311 });
312
313 testPhases('imports cycle, self cycle', phases, {
314 'a|web/test.html':
315 '<!DOCTYPE html><html><head>'
316 '<link rel="import" href="test_1.html">'
317 '</head></html>',
318 'a|web/test_1.html':
319 '<!DOCTYPE html><html><head>'
320 '<link rel="import" href="test_1.html">'
321 '</head><body><polymer-element>1</polymer-element></html>',
322 }, {
323 'a|web/test.html':
324 '<!DOCTYPE html><html><head>'
325 '</head><body>'
326 '<polymer-element>1</polymer-element></body></html>',
327 'a|web/test_1.html':
328 '<!DOCTYPE html><html><head>'
329 '</head><body>'
330 '<polymer-element>1</polymer-element></body></html>',
331 });
332
333 testPhases('imports DAG', phases, {
334 'a|web/test.html':
335 '<!DOCTYPE html><html><head>'
336 '<link rel="import" href="test_1.html">'
337 '<link rel="import" href="test_2.html">'
338 '</head></html>',
339 'a|web/test_1.html':
340 '<!DOCTYPE html><html><head>'
341 '<link rel="import" href="test_3.html">'
342 '</head><body><polymer-element>1</polymer-element></body></html>',
343 'a|web/test_2.html':
344 '<!DOCTYPE html><html><head>'
345 '<link rel="import" href="test_3.html">'
346 '</head><body><polymer-element>2</polymer-element></body></html>',
347 'a|web/test_3.html':
348 '<!DOCTYPE html><html><head>'
349 '</head><body><polymer-element>3</polymer-element></body></html>',
350 }, {
351 'a|web/test.html':
352 '<!DOCTYPE html><html><head>'
353 '</head><body>'
354 '<polymer-element>3</polymer-element>'
355 '<polymer-element>1</polymer-element>'
356 '<polymer-element>2</polymer-element></body></html>',
357 'a|web/test_1.html':
358 '<!DOCTYPE html><html><head>'
359 '</head><body>'
360 '<polymer-element>3</polymer-element>'
361 '<polymer-element>1</polymer-element></body></html>',
362 'a|web/test_2.html':
363 '<!DOCTYPE html><html><head>'
364 '</head><body>'
365 '<polymer-element>3</polymer-element>'
366 '<polymer-element>2</polymer-element></body></html>',
367 'a|web/test_3.html':
368 '<!DOCTYPE html><html><head>'
369 '</head><body>'
370 '<polymer-element>3</polymer-element></body></html>',
371 });
372 }
OLDNEW
« no previous file with comments | « pkg/polymer/test/transform/common.dart ('k') | pkg/polymer/test/transform/polyfill_injector_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698