| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library polymer.test.linter_test; | 5 library polymer.test.linter_test; |
| 6 | 6 |
| 7 import 'dart:convert'; | 7 import 'dart:convert'; |
| 8 | 8 |
| 9 import 'package:polymer/src/build/common.dart'; | 9 import 'package:polymer/src/build/common.dart'; |
| 10 import 'package:polymer/src/build/linter.dart'; | 10 import 'package:polymer/src/build/linter.dart'; |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 }, [ | 145 }, [ |
| 146 'warning: ${NO_DART_SCRIPT_AND_EXPERIMENTAL.snippet} ' | 146 'warning: ${NO_DART_SCRIPT_AND_EXPERIMENTAL.snippet} ' |
| 147 '(web/test.html 1 0)', | 147 '(web/test.html 1 0)', |
| 148 ]); | 148 ]); |
| 149 | 149 |
| 150 _testLinter('missing Dart code and polymer.html', { | 150 _testLinter('missing Dart code and polymer.html', { |
| 151 'a|web/test.html': '<!DOCTYPE html><html></html>', | 151 'a|web/test.html': '<!DOCTYPE html><html></html>', |
| 152 }, [ | 152 }, [ |
| 153 'warning: ${MISSING_INIT_POLYMER.snippet}', | 153 'warning: ${MISSING_INIT_POLYMER.snippet}', |
| 154 ]); | 154 ]); |
| 155 |
| 156 _testLinter('dart_support unnecessary', { |
| 157 'a|web/test.html': '<!DOCTYPE html><html>' |
| 158 '<script src="packages/web_components/dart_support.js"></script>' |
| 159 '<link rel="import" href="../../packages/polymer/polymer.html">' |
| 160 '<polymer-element name="x-a"></polymer-element>' |
| 161 '<script type="application/dart" src="foo.dart">' |
| 162 '</script>' |
| 163 '<script src="packages/browser/dart.js"></script>' |
| 164 '</html>', |
| 165 }, [ |
| 166 'warning: ${DART_SUPPORT_NO_LONGER_REQUIRED.snippet} ' |
| 167 '(web/test.html 0 21)' |
| 168 ]); |
| 169 |
| 155 }); | 170 }); |
| 156 | 171 |
| 157 group('single script tag per document', () { | 172 group('single script tag per document', () { |
| 158 _testLinter('two top-level tags', { | 173 _testLinter('two top-level tags', { |
| 159 'a|web/test.html': '<!DOCTYPE html><html>' | 174 'a|web/test.html': '<!DOCTYPE html><html>' |
| 160 '<link rel="import" href="packages/polymer/polymer.html">' | 175 '<link rel="import" href="packages/polymer/polymer.html">' |
| 161 '<script type="application/dart" src="a.dart">' | 176 '<script type="application/dart" src="a.dart">' |
| 162 '</script>\n' | 177 '</script>\n' |
| 163 '<script type="application/dart" src="b.dart">' | 178 '<script type="application/dart" src="b.dart">' |
| 164 '</script>' | 179 '</script>' |
| (...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 } | 816 } |
| 802 if (outputMessages.isEmpty) { | 817 if (outputMessages.isEmpty) { |
| 803 var linter = new Linter(new TransformOptions()); | 818 var linter = new Linter(new TransformOptions()); |
| 804 testPhases(name, [[linter]], inputFiles, outputFiles, outputMessages, solo); | 819 testPhases(name, [[linter]], inputFiles, outputFiles, outputMessages, solo); |
| 805 } else { | 820 } else { |
| 806 testLogOutput( | 821 testLogOutput( |
| 807 (options) => new Linter(options), name, inputFiles, outputFiles, | 822 (options) => new Linter(options), name, inputFiles, outputFiles, |
| 808 outputMessages, solo); | 823 outputMessages, solo); |
| 809 } | 824 } |
| 810 } | 825 } |
| OLD | NEW |