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

Unified Diff: test/analyzer_test.dart

Issue 12016007: Add a warning about using a component that isn't referenced (Closed) Base URL: https://github.com/dart-lang/web-ui.git@master
Patch Set: Created 7 years, 11 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 | « lib/src/analyzer.dart ('k') | test/testing.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/analyzer_test.dart
diff --git a/test/analyzer_test.dart b/test/analyzer_test.dart
index fe5b3e353a44ce4a8a74bf698d58275b69982901..cfbeb40c72ef048b4320032195ae43c00b0c0cd8 100644
--- a/test/analyzer_test.dart
+++ b/test/analyzer_test.dart
@@ -16,7 +16,7 @@ import 'package:web_ui/src/messages.dart';
import 'package:web_ui/src/utils.dart';
import 'package:logging/logging.dart';
import 'testing.dart';
-import 'testing.dart' as testing show analyzeElement, analyzeDefinitionsInTree;
+import 'testing.dart' as testing;
Siggi Cherem (dart-lang) 2013/01/18 02:56:56 do we need two imports to the same file?
Jennifer Messerly 2013/01/18 02:59:31 Not sure what the original intent was? I guess we
main() {
useCompactVMConfiguration();
@@ -29,6 +29,8 @@ main() {
analyzeDefinitionsInTree(doc) => testing.analyzeDefinitionsInTree(
doc, messages: messages);
+ analyzeFiles(files) => testing.analyzeFiles(files, messages: messages);
+
group("", () {
setUp(() {
messages = new Messages.silent();
@@ -466,6 +468,34 @@ main() {
expect(info.loopItems, equals('bar'));
});
+ test('component is="" not found - warning', () {
+ var elem = parseSubtree('<li is="x-todo-row"></li>');
+ var info = analyzeElement(elem);
+ expect(messages.length, 1);
+ expect(messages[0].message, contains('x-todo-row not found'));
+ expect(messages[0].span, equals(elem.sourceSpan));
+ });
+
+ test('component custom tag not found - warning', () {
+ var elem = parseSubtree('<x-todo-row></x-todo-row>');
+ var info = analyzeElement(elem);
+ expect(messages.length, 1);
+ expect(messages[0].message, contains('x-todo-row not found'));
+ expect(messages[0].span, equals(elem.sourceSpan));
+ });
+
+ test('extends not found - warning', () {
+ var files = parseFiles({
+ 'index.html': '<body><element name="x-quux3" extends="x-foo" '
+ 'constructor="Bar"><template>'
+ });
+ var fileInfo = analyzeFiles(files);
+ var elem = fileInfo['index.html'].bodyInfo.node.query('element');
+ expect(messages.length, 1);
+ expect(messages[0].message, contains('x-foo not found'));
+ expect(messages[0].span, equals(elem.sourceSpan));
+ });
+
test('data-value - deprecated', () {
var elem = parseSubtree('<li is="x-todo-row" data-value="todo:x"></li>');
var info = analyzeElement(elem);
@@ -479,6 +509,7 @@ main() {
expect(messages[1].span, equals(elem.sourceSpan));
});
+
test('component properties 1-way binding', () {
var files = parseFiles({
'index.html': '<head><link rel="components" href="foo.html">'
« no previous file with comments | « lib/src/analyzer.dart ('k') | test/testing.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698