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

Unified Diff: pkg/polymer/test/build/linter_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 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/polyfill_injector_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 98f4c3fcc6e58cdb5ab1e9e01ff0f18596cc12ae..1e216e18186671d320009508f9c1b4f7679eeb57 100644
--- a/pkg/polymer/test/build/linter_test.dart
+++ b/pkg/polymer/test/build/linter_test.dart
@@ -50,6 +50,48 @@ void main() {
'(web/test.html 1 0)',
});
});
+ group('single script tag per document', () {
+ _testLinter('two top-level tags', {
+ 'a|web/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>'
+ }, {
+ 'a|web/test.html.messages':
+ '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>'
+ }, {
+ 'a|lib/test.html.messages':
+ '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>'
+ '<polymer-element name="x-a">'
+ '<script type="application/dart" src="a.dart">'
+ '</script>'
+ '</polymer-element>\n'
+ '<script type="application/dart" src="b.dart">'
+ '</script>'
+ '<script src="packages/browser/dart.js"></script>'
+ }, {
+ 'a|web/test.html.messages':
+ 'warning: Only one "application/dart" script tag per document is'
+ ' allowed. (web/test.html 1 0)',
+ });
+ });
group('doctype warning', () {
_testLinter('in web', {
@@ -213,8 +255,7 @@ void main() {
</html>'''.replaceAll(' ', ''),
}, {
'a|lib/test.html.messages':
- 'warning: script tag with .dart source file but no type will be '
- 'treated as JavaScript. Did you forget type="application/dart"?'
+ 'warning: Wrong script type, expected type="application/dart".'
' (lib/test.html 1 0)'
});
@@ -226,8 +267,7 @@ void main() {
</html>'''.replaceAll(' ', ''),
}, {
'a|lib/test.html.messages':
- 'warning: script tag with .dart source file but no type will be '
- 'treated as JavaScript. Did you forget type="application/dart"?'
+ 'warning: Wrong script type, expected type="application/dart".'
' (lib/test.html 2 0)'
});
@@ -256,7 +296,7 @@ void main() {
_testLinter('top-level, dart type & .dart url', {
'a|lib/test.html': '''<html>
- <script type="applicatino/dart" src="foo.dart"></script>
+ <script type="application/dart" src="foo.dart"></script>
</html>'''.replaceAll(' ', ''),
}, {
'a|lib/test.html.messages': ''
« no previous file with comments | « pkg/polymer/test/build/import_inliner_test.dart ('k') | pkg/polymer/test/build/polyfill_injector_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698