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

Unified Diff: pkg/polymer/test/build/all_phases_test.dart

Issue 293023008: Bring back initPolymer, allow boot.js only if using "polymer_experimental.html". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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/bind_test.html ('k') | pkg/polymer/test/build/code_extractor.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer/test/build/all_phases_test.dart
diff --git a/pkg/polymer/test/build/all_phases_test.dart b/pkg/polymer/test/build/all_phases_test.dart
index 2427976eeec7b2bde6d2c68c2a9f888cc1fd78ee..5ec31f3729820d8653503e5ec98cef7ab12794e6 100644
--- a/pkg/polymer/test/build/all_phases_test.dart
+++ b/pkg/polymer/test/build/all_phases_test.dart
@@ -6,8 +6,8 @@ library polymer.test.build.all_phases_test;
import 'package:code_transformers/tests.dart' show testingDartSdkDirectory;
import 'package:polymer/src/build/common.dart';
-import 'package:polymer/src/build/import_inliner.dart' show COMPONENT_WARNING;
-import 'package:polymer/src/build/linter.dart' show USE_POLYMER_HTML;
+import 'package:polymer/src/build/linter.dart' show USE_POLYMER_HTML,
+ USE_INIT_DART, ONLY_ONE_TAG;
import 'package:polymer/src/build/script_compactor.dart' show MAIN_HEADER;
import 'package:polymer/transformer.dart';
import 'package:smoke/codegen/generator.dart' show DEFAULT_IMPORTS;
@@ -23,7 +23,8 @@ void main() {
testPhases('no changes', phases, {
'a|web/test.html': '<!DOCTYPE html><html></html>',
}, {}, [
- 'warning: $USE_POLYMER_HTML'
+ 'warning: $USE_POLYMER_HTML',
+ 'warning: $USE_INIT_DART'
]);
testPhases('observable changes', phases, {
@@ -38,7 +39,7 @@ void main() {
'a|web/test.html':
'<!DOCTYPE html><html><head>'
'<link rel="import" href="packages/polymer/polymer.html">'
- '<script type="application/dart;component=1" src="a.dart"></script>',
+ '<script type="application/dart" src="a.dart"></script>',
'a|web/a.dart': _sampleInput('A', 'foo'),
}, {
'a|web/test.html':
@@ -64,20 +65,21 @@ void main() {
declarations: {
smoke_0.XA: const {},
}));
- startPolymer([
+ configureForDeployment([
i0.m_foo,
() => Polymer.register('x-A', i0.XA),
]);
+ i0.main();
}
'''.replaceAll('\n ', '\n'),
'a|web/a.dart': _sampleOutput('A', 'foo'),
- });
+ }, []);
testPhases('single inline script', phases, {
'a|web/test.html':
'<!DOCTYPE html><html><head>'
'<link rel="import" href="packages/polymer/polymer.html">'
- '<script type="application/dart;component=1">'
+ '<script type="application/dart">'
'${_sampleInput("B", "bar")}</script>',
}, {
'a|web/test.html':
@@ -103,144 +105,154 @@ void main() {
declarations: {
smoke_0.XB: const {},
}));
- startPolymer([
+ configureForDeployment([
i0.m_bar,
() => Polymer.register('x-B', i0.XB),
]);
+ i0.main();
}
'''.replaceAll('\n ', '\n'),
'a|web/test.html.0.dart':
_sampleOutput("B", "bar"),
});
- testPhases('several application scripts', phases, {
+ testPhases('several scripts', phases, {
'a|web/test.html':
'<!DOCTYPE html><html><head>'
- '<link rel="import" href="packages/polymer/polymer.html">'
- '<script type="application/dart;component=1" src="a.dart"></script>'
+ '<link rel="import" href="packages/polymer/polymer.html">\n'
+ '<script type="application/dart" src="a.dart"></script>\n'
'<script type="application/dart">'
'${_sampleInput("B", "bar")}</script>'
- '</head><body><div>'
+ '</head><body><div>\n'
'<script type="application/dart">'
'${_sampleInput("C", "car")}</script>'
- '</div>'
+ '</div>\n'
'<script type="application/dart" src="d.dart"></script>',
'a|web/a.dart': _sampleInput('A', 'foo'),
}, {
'a|web/test.html':
'<!DOCTYPE html><html><head>'
- '$WEB_COMPONENTS_TAG'
+ '$WEB_COMPONENTS_TAG\n\n'
'</head><body>'
- '<script src="test.html.0.dart.js"></script>'
- '<div>'
- '<script src="test.html.1.dart.js"></script>'
- '</div>'
- '<script src="d.dart.js"></script>'
+ '<div>\n</div>\n'
'<script src="test.html_bootstrap.dart.js"></script>'
'</body></html>',
-
'a|web/test.html_bootstrap.dart':
'''$MAIN_HEADER
import 'a.dart' as i0;
+ import 'test.html.0.dart' as i1;
+ import 'test.html.1.dart' as i2;
${DEFAULT_IMPORTS.join('\n')}
import 'a.dart' as smoke_0;
import 'package:polymer/polymer.dart' as smoke_1;
+ import 'test.html.0.dart' as smoke_2;
+ import 'test.html.1.dart' as smoke_3;
void main() {
useGeneratedCode(new StaticConfiguration(
checkedMode: false,
parents: {
smoke_0.XA: smoke_1.PolymerElement,
+ smoke_2.XB: smoke_1.PolymerElement,
+ smoke_3.XC: smoke_1.PolymerElement,
},
declarations: {
smoke_0.XA: const {},
+ smoke_2.XB: const {},
+ smoke_3.XC: const {},
}));
- startPolymer([
+ configureForDeployment([
i0.m_foo,
() => Polymer.register('x-A', i0.XA),
+ i1.m_bar,
+ () => Polymer.register('x-B', i1.XB),
+ i2.m_car,
+ () => Polymer.register('x-C', i2.XC),
]);
+ i2.main();
}
'''.replaceAll('\n ', '\n'),
'a|web/a.dart': _sampleOutput('A', 'foo'),
}, [
// These should not be emitted multiple times. See:
// https://code.google.com/p/dart/issues/detail?id=17197
- 'warning: $COMPONENT_WARNING (web/test.html 14 27)',
- 'warning: $COMPONENT_WARNING (web/test.html 28 15)'
+ 'warning: $ONLY_ONE_TAG (web/test.html 2 0)',
+ 'warning: $ONLY_ONE_TAG (web/test.html 18 0)',
+ 'warning: $ONLY_ONE_TAG (web/test.html 34 0)',
+ 'warning: Script file at "d.dart" not found. (web/test.html 34 0)',
]);
- testPhases('several component scripts', phases, {
- 'a|web/test.html':
+ testPhases('with imports', phases, {
+ 'a|web/index.html':
'<!DOCTYPE html><html><head>'
'<link rel="import" href="packages/polymer/polymer.html">'
- '<script type="application/dart;component=1" src="a.dart"></script>'
- '<script type="application/dart;component=1">'
- '${_sampleInput("B", "bar")}</script>'
- '</head><body><div>'
- '<script type="application/dart;component=1">'
- '${_sampleInput("C", "car")}</script>'
- '</div>',
- 'a|web/a.dart': _sampleInput('A', 'foo'),
+ '<link rel="import" href="packages/a/test2.html">'
+ '</head><body>'
+ '<script type="application/dart" src="b.dart"></script>',
+ 'a|web/b.dart': _sampleInput('B', 'bar'),
+ 'a|lib/test2.html':
+ '<!DOCTYPE html><html><head></head><body>'
+ '<polymer-element name="x-a">1'
+ '<script type="application/dart">'
+ '${_sampleInput("A", "foo")}</script>'
+ '</polymer-element></html>',
}, {
- 'a|web/test.html':
+ 'a|web/index.html':
'<!DOCTYPE html><html><head>'
'$WEB_COMPONENTS_TAG'
- '</head><body>'
- '<div></div>'
- '<script src="test.html_bootstrap.dart.js"></script>'
+ '</head><body><polymer-element name="x-a">1</polymer-element>'
+ '<script src="index.html_bootstrap.dart.js"></script>'
'</body></html>',
-
- 'a|web/test.html_bootstrap.dart':
+ 'a|web/index.html_bootstrap.dart':
'''$MAIN_HEADER
- import 'a.dart' as i0;
- import 'test.html.0.dart' as i1;
- import 'test.html.1.dart' as i2;
+ import 'index.html.0.dart' as i0;
+ import 'b.dart' as i1;
${DEFAULT_IMPORTS.join('\n')}
- import 'a.dart' as smoke_0;
+ import 'index.html.0.dart' as smoke_0;
import 'package:polymer/polymer.dart' as smoke_1;
- import 'test.html.0.dart' as smoke_2;
- import 'test.html.1.dart' as smoke_3;
+ import 'b.dart' as smoke_2;
void main() {
useGeneratedCode(new StaticConfiguration(
checkedMode: false,
parents: {
- smoke_0.XA: smoke_1.PolymerElement,
smoke_2.XB: smoke_1.PolymerElement,
- smoke_3.XC: smoke_1.PolymerElement,
+ smoke_0.XA: smoke_1.PolymerElement,
},
declarations: {
- smoke_0.XA: const {},
smoke_2.XB: const {},
- smoke_3.XC: const {},
+ smoke_0.XA: const {},
}));
- startPolymer([
+ configureForDeployment([
i0.m_foo,
() => Polymer.register('x-A', i0.XA),
i1.m_bar,
() => Polymer.register('x-B', i1.XB),
- i2.m_car,
- () => Polymer.register('x-C', i2.XC),
]);
+ i1.main();
}
'''.replaceAll('\n ', '\n'),
- 'a|web/a.dart': _sampleOutput('A', 'foo'),
+ 'a|web/index.html.0.dart': _sampleOutput("A", "foo"),
+ 'a|web/b.dart': _sampleOutput('B', 'bar'),
}, []);
- testPhases('with imports', phases, {
+ testPhases('experimental bootstrap', phases, {
'a|web/index.html':
'<!DOCTYPE html><html><head>'
- '<link rel="import" href="packages/polymer/polymer.html">'
- '<link rel="import" href="test2.html">'
- '</head><body>'
- '<script type="application/dart;component=1" src="b.dart"></script>',
- 'a|web/b.dart': _sampleInput('B', 'bar'),
- 'a|web/test2.html':
+ '<link rel="import" '
+ 'href="packages/polymer/polymer_experimental.html">'
+ '<link rel="import" href="packages/a/test2.html">'
+ '<link rel="import" href="packages/a/load_b.html">',
+ 'a|lib/b.dart': _sampleInput('B', 'bar'),
+ 'a|lib/test2.html':
'<!DOCTYPE html><html><head></head><body>'
'<polymer-element name="x-a">1'
- '<script type="application/dart;component=1">'
+ '<script type="application/dart">'
'${_sampleInput("A", "foo")}</script>'
'</polymer-element></html>',
+ 'a|lib/load_b.html':
+ '<!DOCTYPE html><html><head></head><body>'
+ '<script type="application/dart" src="b.dart"></script>',
}, {
'a|web/index.html':
'<!DOCTYPE html><html><head>'
@@ -251,22 +263,22 @@ void main() {
'a|web/index.html_bootstrap.dart':
'''$MAIN_HEADER
import 'index.html.0.dart' as i0;
- import 'b.dart' as i1;
+ import 'package:a/b.dart' as i1;
${DEFAULT_IMPORTS.join('\n')}
import 'index.html.0.dart' as smoke_0;
import 'package:polymer/polymer.dart' as smoke_1;
- import 'b.dart' as smoke_2;
+ import 'package:a/b.dart' as smoke_2;
void main() {
useGeneratedCode(new StaticConfiguration(
checkedMode: false,
parents: {
- smoke_2.XB: smoke_1.PolymerElement,
smoke_0.XA: smoke_1.PolymerElement,
+ smoke_2.XB: smoke_1.PolymerElement,
},
declarations: {
- smoke_2.XB: const {},
smoke_0.XA: const {},
+ smoke_2.XB: const {},
}));
startPolymer([
i0.m_foo,
@@ -277,8 +289,8 @@ void main() {
}
'''.replaceAll('\n ', '\n'),
'a|web/index.html.0.dart': _sampleOutput("A", "foo"),
- 'a|web/b.dart': _sampleOutput('B', 'bar'),
- });
+ 'a|lib/b.dart': _sampleOutput('B', 'bar'),
+ }, []);
}
String _sampleInput(String className, String fieldName) => '''
@@ -296,6 +308,7 @@ class X${className} extends PolymerElement {
X${className}.created() : super.created();
}
@initMethod m_$fieldName() {}
+main() {}
''';
@@ -321,5 +334,6 @@ class X${className} extends PolymerElement {
X${className}.created() : super.created();
}
@initMethod m_$fieldName() {}
+main() {}
''';
}
« no previous file with comments | « pkg/polymer/test/bind_test.html ('k') | pkg/polymer/test/build/code_extractor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698