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

Side by Side Diff: pkg/polymer/test/build/linter_test.dart

Issue 528093002: FOUC lint test (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: update changelog/pubspec Created 6 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/polymer/pubspec.yaml ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 '''.replaceAll(' ', ''), 618 '''.replaceAll(' ', ''),
619 'a|lib/test.html': ''' 619 'a|lib/test.html': '''
620 <link rel="import" href="../../packages/polymer/polymer.html"> 620 <link rel="import" href="../../packages/polymer/polymer.html">
621 <link rel="import" href="b.html"> 621 <link rel="import" href="b.html">
622 <span is="x-a"></span> 622 <span is="x-a"></span>
623 '''.replaceAll(' ', ''), 623 '''.replaceAll(' ', ''),
624 }, [ 624 }, [
625 'warning: custom element "x-a" extends from "li". Did you mean ' 625 'warning: custom element "x-a" extends from "li". Did you mean '
626 'to write <li is="x-a">? (lib/test.html 2 0)' 626 'to write <li is="x-a">? (lib/test.html 2 0)'
627 ]); 627 ]);
628
629 const String foucWarning =
630 'warning: Custom element found in document body without an '
631 '"unresolved" attribute on it or one of its parents. This means '
632 'your app probably has a flash of unstyled content before it '
633 'finishes loading. See http://goo.gl/iN03Pj for more info.';
634
635 _testLinter('FOUC warning works', {
636 'a|lib/a.html': '''
637 <html><body>
638 <link rel="import" href="../../packages/polymer/polymer.html">
639 <polymer-element name="my-element" noscript></polymer-element>
640 <my-element>hello!</my-element>
641 </body></html>
642 ''',
643 'a|lib/b.html': '''
644 <html><body>
645 <link rel="import" href="../../packages/polymer/polymer.html">
646 <polymer-element name="my-element" noscript></polymer-element>
647 <div><my-element>hello!</my-element></div>
648 </body></html>
649 ''',
650 'a|lib/c.html': '''
651 <html unresolved><body>
652 <link rel="import" href="../../packages/polymer/polymer.html">
653 <polymer-element name="my-element" noscript></polymer-element>
654 <my-element>hello!</my-element>
655 </body></html>
656 '''
657 }, [
658 '$foucWarning (lib/a.html 3 14)',
659 '$foucWarning (lib/b.html 3 19)',
660 '$foucWarning (lib/c.html 3 14)',
661 ]);
662
663 _testLinter('FOUC, no false positives.', {
664 'a|lib/a.html': '''
665 <html><body><div unresolved>
666 <link rel="import" href="../../packages/polymer/polymer.html">
667 <polymer-element name="my-element" noscript></polymer-element>
668 <my-element>hello!</my-element>
669 </div></body></html>
670 ''',
671 'a|lib/b.html': '''
672 <html><body unresolved>
673 <link rel="import" href="../../packages/polymer/polymer.html">
674 <polymer-element name="my-element" noscript></polymer-element>
675 <my-element>hello!</my-element>
676 </body></html>
677 ''',
678 'a|lib/c.html': '''
679 <html><body>
680 <link rel="import" href="../../packages/polymer/polymer.html">
681 <polymer-element name="my-element" noscript></polymer-element>
682 <polymer-element name="foo-element">
683 <template><my-element>hello!</my-element></template>
684 </polymer-element>
685 </body></html>
686 ''',
687 'a|lib/d.html': '''
688 <html><body>
689 <link rel="import" href="../../packages/polymer/polymer.html">
690 <polymer-element name="my-element" noscript></polymer-element>
691 <my-element></my-element>
692 </body></html>
693 ''',
694 }, []);
628 }); 695 });
629 696
630 group('custom attributes', () { 697 group('custom attributes', () {
631 _testLinter('foo-bar is no longer supported in attributes', { 698 _testLinter('foo-bar is no longer supported in attributes', {
632 'a|lib/test.html': '''<html><body> 699 'a|lib/test.html': '''<html><body>
633 <link rel="import" href="../../packages/polymer/polymer.html"> 700 <link rel="import" href="../../packages/polymer/polymer.html">
634 <polymer-element name="x-a" attributes="foo-bar"> 701 <polymer-element name="x-a" attributes="foo-bar">
635 </polymer-element> 702 </polymer-element>
636 '''.replaceAll(' ', ''), 703 '''.replaceAll(' ', ''),
637 }, [ 704 }, [
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 } 754 }
688 if (outputMessages.isEmpty) { 755 if (outputMessages.isEmpty) {
689 var linter = new Linter(new TransformOptions()); 756 var linter = new Linter(new TransformOptions());
690 testPhases(name, [[linter]], inputFiles, outputFiles, outputMessages, solo); 757 testPhases(name, [[linter]], inputFiles, outputFiles, outputMessages, solo);
691 } else { 758 } else {
692 testLogOutput( 759 testLogOutput(
693 (options) => new Linter(options), name, inputFiles, outputFiles, 760 (options) => new Linter(options), name, inputFiles, outputFiles,
694 outputMessages, solo); 761 outputMessages, solo);
695 } 762 }
696 } 763 }
OLDNEW
« no previous file with comments | « pkg/polymer/pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698