| 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 'package:polymer/src/build/common.dart'; | 7 import 'package:polymer/src/build/common.dart'; |
| 8 import 'package:polymer/src/build/linter.dart'; | 8 import 'package:polymer/src/build/linter.dart'; |
| 9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
| 10 | 10 |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 'warning: definition for Polymer element with tag name "x-foo" not ' | 508 'warning: definition for Polymer element with tag name "x-foo" not ' |
| 509 'found. (lib/test.html 0 0)' | 509 'found. (lib/test.html 0 0)' |
| 510 ]); | 510 ]); |
| 511 | 511 |
| 512 _testLinter('tag exists (type extension)', { | 512 _testLinter('tag exists (type extension)', { |
| 513 'a|lib/test.html': '<div is="x-foo"></div>', | 513 'a|lib/test.html': '<div is="x-foo"></div>', |
| 514 }, [ | 514 }, [ |
| 515 'warning: definition for Polymer element with tag name "x-foo" not ' | 515 'warning: definition for Polymer element with tag name "x-foo" not ' |
| 516 'found. (lib/test.html 0 0)' | 516 'found. (lib/test.html 0 0)' |
| 517 ]); | 517 ]); |
| 518 |
| 519 _testLinter('tag exists (internally defined in code)', { |
| 520 'a|lib/test.html': '<div is="auto-binding-dart"></div>', |
| 521 }, []); |
| 518 | 522 |
| 519 _testLinter('used correctly (no base tag)', { | 523 _testLinter('used correctly (no base tag)', { |
| 520 'a|lib/test.html': ''' | 524 'a|lib/test.html': ''' |
| 521 <link rel="import" href="../../packages/polymer/polymer.html"> | 525 <link rel="import" href="../../packages/polymer/polymer.html"> |
| 522 <polymer-element name="x-a"></polymer-element> | 526 <polymer-element name="x-a"></polymer-element> |
| 523 <x-a></x-a> | 527 <x-a></x-a> |
| 524 '''.replaceAll(' ', ''), | 528 '''.replaceAll(' ', ''), |
| 525 }, []); | 529 }, []); |
| 526 | 530 |
| 527 _testLinter('used incorrectly (no base tag)', { | 531 _testLinter('used incorrectly (no base tag)', { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 | 649 |
| 646 _testLinter(String name, Map inputFiles, List outputMessages, | 650 _testLinter(String name, Map inputFiles, List outputMessages, |
| 647 [bool solo = false]) { | 651 [bool solo = false]) { |
| 648 var linter = new Linter(new TransformOptions()); | 652 var linter = new Linter(new TransformOptions()); |
| 649 var outputFiles = {}; | 653 var outputFiles = {}; |
| 650 if (outputMessages.every((m) => m.startsWith('warning:'))) { | 654 if (outputMessages.every((m) => m.startsWith('warning:'))) { |
| 651 inputFiles.forEach((k, v) => outputFiles[k] = v); | 655 inputFiles.forEach((k, v) => outputFiles[k] = v); |
| 652 } | 656 } |
| 653 testPhases(name, [[linter]], inputFiles, outputFiles, outputMessages, solo); | 657 testPhases(name, [[linter]], inputFiles, outputFiles, outputMessages, solo); |
| 654 } | 658 } |
| OLD | NEW |