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

Unified Diff: pkg/polymer/test/transform/script_compactor_test.dart

Issue 22935016: Introduce polymer transformers (inlined code extraction, inlining html imports, (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/polymer/test/transform/import_inliner_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer/test/transform/script_compactor_test.dart
diff --git a/pkg/polymer/test/transform/script_compactor_test.dart b/pkg/polymer/test/transform/script_compactor_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..13a6bf07b62c4e8220bd3b08a9d804f5005d5a28
--- /dev/null
+++ b/pkg/polymer/test/transform/script_compactor_test.dart
@@ -0,0 +1,89 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library polymer.test.transform.script_compactor_test;
+
+import 'package:polymer/src/transform/script_compactor.dart';
+import 'package:unittest/compact_vm_config.dart';
+
+import 'common.dart';
+
+void main() {
+ useCompactVMConfiguration();
+
+ testPhases('no changes', [[new ScriptCompactor()]], {
+ 'a|test.html': '<!DOCTYPE html><html></html>',
+ }, {
+ 'a|test.html': '<!DOCTYPE html><html></html>',
+ });
+
+ testPhases('single script', [[new ScriptCompactor()]], {
+ 'a|test.html':
+ '<!DOCTYPE html><html><head>'
+ '<script type="application/dart" src="a.dart"></script>',
+ }, {
+ 'a|test.html':
+ '<!DOCTYPE html><html><head></head><body>'
+ '<script type="application/dart" '
+ 'src="test.html_bootstrap.dart"></script>'
+ '</body></html>',
+
+ 'a|test.html_bootstrap.dart':
+ '''library app_bootstrap;
+
+ import 'package:polymer/polymer.dart';
+ import 'dart:mirrors' show currentMirrorSystem;
+
+ import 'a.dart' as i0;
+
+ void main() {
+ initPolymer([
+ 'a.dart',
+ ],
+ currentMirrorSystem().findLibrary(const Symbol('app_bootstrap'))
+ .first.uri.toString());
+ }
+ '''.replaceAll('\n ', '\n'),
+ });
+
+ testPhases('several scripts', [[new ScriptCompactor()]], {
+ 'a|test.html':
+ '<!DOCTYPE html><html><head>'
+ '<script type="application/dart" src="a.dart"></script>'
+ '<script type="application/dart" src="b.dart"></script>'
+ '</head><body><div>'
+ '<script type="application/dart" src="c.dart"></script>'
+ '</div>'
+ '<script type="application/dart" src="d.dart"></script>',
+ }, {
+ 'a|test.html':
+ '<!DOCTYPE html><html><head></head><body><div></div>'
+ '<script type="application/dart" '
+ 'src="test.html_bootstrap.dart"></script>'
+ '</body></html>',
+
+ 'a|test.html_bootstrap.dart':
+ '''library app_bootstrap;
+
+ import 'package:polymer/polymer.dart';
+ import 'dart:mirrors' show currentMirrorSystem;
+
+ import 'a.dart' as i0;
+ import 'b.dart' as i1;
+ import 'c.dart' as i2;
+ import 'd.dart' as i3;
+
+ void main() {
+ initPolymer([
+ 'a.dart',
+ 'b.dart',
+ 'c.dart',
+ 'd.dart',
+ ],
+ currentMirrorSystem().findLibrary(const Symbol('app_bootstrap'))
+ .first.uri.toString());
+ }
+ '''.replaceAll('\n ', '\n'),
+ });
+}
« no previous file with comments | « pkg/polymer/test/transform/import_inliner_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698