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

Unified Diff: pkg/polymer/test/build/linter_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/build/import_inliner_test.dart ('k') | pkg/polymer/test/build/script_compactor_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer/test/build/linter_test.dart
diff --git a/pkg/polymer/test/build/linter_test.dart b/pkg/polymer/test/build/linter_test.dart
index 341e23816279560792f6c80c0f2f1d8a480ec76f..e066960d7a95b274c7014f79bebe067a099708b9 100644
--- a/pkg/polymer/test/build/linter_test.dart
+++ b/pkg/polymer/test/build/linter_test.dart
@@ -15,7 +15,7 @@ void main() {
'a|lib/test.html': '<!DOCTYPE html><html></html>',
}, []);
- group('must have import to polymer.html', () {
+ group('must have proper initialization imports', () {
_testLinter('nothing to report', {
'a|web/test.html': '<!DOCTYPE html><html>'
'<link rel="import" href="packages/polymer/polymer.html">'
@@ -25,24 +25,54 @@ void main() {
'</html>',
}, []);
- _testLinter('missing everything', {
- 'a|web/test.html': '<!DOCTYPE html><html></html>',
+ _testLinter('missing polymer.html', {
+ 'a|web/test.html': '<!DOCTYPE html><html>'
+ '<script type="application/dart" src="foo.dart">'
+ '</script>'
+ '<script src="packages/browser/dart.js"></script>'
+ '</html>',
}, [
'warning: $USE_POLYMER_HTML',
]);
- _testLinter('using deprecated boot.js', {
- 'a|web/test.html': '<!DOCTYPE html><html>\n'
- '<script src="packages/polymer/boot.js"></script>'
+ _testLinter('missing Dart code', {
+ 'a|web/test.html': '<!DOCTYPE html><html>'
+ '<link rel="import" href="packages/polymer/polymer.html">'
+ '<script src="packages/browser/dart.js"></script>'
+ '</html>',
+ }, [
+ 'warning: $USE_INIT_DART',
+ ]);
+
+ _testLinter('nothing to report, experimental with no Dart code', {
+ 'a|web/test.html': '<!DOCTYPE html><html>'
+ '<link rel="import" '
+ 'href="packages/polymer/polymer_experimental.html">'
+ '<script src="packages/browser/dart.js"></script>'
+ '</html>',
+ }, []);
+
+ _testLinter('experimental cannot have Dart code in main document', {
+ 'a|web/test.html': '<!DOCTYPE html><html>'
+ '<link rel="import" '
+ 'href="packages/polymer/polymer_experimental.html">\n'
'<script type="application/dart" src="foo.dart">'
'</script>'
'<script src="packages/browser/dart.js"></script>'
'</html>',
}, [
+ 'warning: $NO_DART_SCRIPT_AND_EXPERIMENTAL (web/test.html 1 0)',
+ ]);
+
+ _testLinter('missing Dart code and polymer.html', {
+ 'a|web/test.html': '<!DOCTYPE html><html></html>',
+ }, [
'warning: $USE_POLYMER_HTML',
+ 'warning: $USE_INIT_DART',
]);
});
- group('multiple script tag per document allowed', () {
+
+ group('single script tag per document', () {
_testLinter('two top-level tags', {
'a|web/test.html': '<!DOCTYPE html><html>'
'<link rel="import" href="packages/polymer/polymer.html">'
@@ -50,8 +80,23 @@ void main() {
'</script>\n'
'<script type="application/dart" src="b.dart">'
'</script>'
+ '<script src="packages/browser/dart.js"></script>',
+ }, [
+ 'warning: Only one "application/dart" script tag per document is'
+ ' allowed. (web/test.html 1 0)',
+ ]);
+
+ _testLinter('two top-level tags, non entrypoint', {
+ 'a|lib/test.html': '<!DOCTYPE html><html>'
+ '<script type="application/dart" src="a.dart">'
+ '</script>\n'
+ '<script type="application/dart" src="b.dart">'
+ '</script>'
'<script src="packages/browser/dart.js"></script>'
- }, []);
+ }, [
+ 'warning: Only one "application/dart" script tag per document is'
+ ' allowed. (lib/test.html 1 0)',
+ ]);
_testLinter('tags inside elements', {
'a|web/test.html': '<!DOCTYPE html><html>'
@@ -62,8 +107,11 @@ void main() {
'</polymer-element>\n'
'<script type="application/dart" src="b.dart">'
'</script>'
- '<script src="packages/browser/dart.js"></script>'
- }, []);
+ '<script src="packages/browser/dart.js"></script>',
+ }, [
+ 'warning: Only one "application/dart" script tag per document is'
+ ' allowed. (web/test.html 1 0)',
+ ]);
});
group('doctype warning', () {
@@ -73,6 +121,7 @@ void main() {
'warning: Unexpected start tag (html). Expected DOCTYPE. '
'(web/test.html 0 0)',
'warning: $USE_POLYMER_HTML',
+ 'warning: $USE_INIT_DART',
]);
_testLinter('in lib', {
@@ -210,8 +259,8 @@ void main() {
<script src="foo.dart"></script>
</html>'''.replaceAll(' ', ''),
}, [
- 'warning: Wrong script type, expected type="application/dart" or'
- ' type="application/dart;component=1". (lib/test.html 1 0)'
+ 'warning: Wrong script type, expected type="application/dart".'
+ ' (lib/test.html 1 0)'
]);
_testLinter('in polymer-element, .dart url', {
@@ -221,8 +270,8 @@ void main() {
</polymer-element>
</html>'''.replaceAll(' ', ''),
}, [
- 'warning: Wrong script type, expected type="application/dart" or'
- ' type="application/dart;component=1". (lib/test.html 2 0)'
+ 'warning: Wrong script type, expected type="application/dart".'
+ ' (lib/test.html 2 0)'
]);
_testLinter('in polymer-element, .js url', {
« no previous file with comments | « pkg/polymer/test/build/import_inliner_test.dart ('k') | pkg/polymer/test/build/script_compactor_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698