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

Unified Diff: pkg/analyzer/test/src/task/html_test.dart

Issue 1395033003: Ignore absence of DOCTYPE in HTML files. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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/analyzer/test/src/context/context_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/task/html_test.dart
diff --git a/pkg/analyzer/test/src/task/html_test.dart b/pkg/analyzer/test/src/task/html_test.dart
index 7d8da565b99051ee5aabe6e2c92ca0edfa27ed28..a90116545e4d7b8d409c0abcf83f9df75409a22c 100644
--- a/pkg/analyzer/test/src/task/html_test.dart
+++ b/pkg/analyzer/test/src/task/html_test.dart
@@ -9,6 +9,7 @@ import 'package:analyzer/src/task/html.dart';
import 'package:analyzer/task/general.dart';
import 'package:analyzer/task/html.dart';
import 'package:analyzer/task/model.dart';
+import 'package:html/dom.dart';
import 'package:unittest/unittest.dart';
import '../../reflective_tests.dart';
@@ -228,7 +229,7 @@ class HtmlErrorsTaskTest extends AbstractContextTest {
r'''
<html>
<head>
- <title>test page</title>
+ <title>test page</not-title>
</head>
<body>
Test
@@ -335,4 +336,33 @@ class ParseHtmlTaskTest extends AbstractContextTest {
}
}
}
+
+ test_perform_noDocType() {
+ String code = r'''
+<div>AAA</div>
+<span>BBB</span>
+''';
+ AnalysisTarget target = newSource('/test.html', code);
+ computeResult(target, HTML_DOCUMENT);
+ expect(task, isParseHtmlTask);
+ // validate Document
+ {
+ Document document = outputs[HTML_DOCUMENT];
+ expect(document, isNotNull);
+ // artificial <html>
+ expect(document.nodes, hasLength(1));
+ Element htmlElement = document.nodes[0];
+ expect(htmlElement.localName, 'html');
+ // artificial <body>
+ expect(htmlElement.nodes, hasLength(2));
+ Element bodyElement = htmlElement.nodes[1];
+ expect(bodyElement.localName, 'body');
+ // actual nodes
+ expect(bodyElement.nodes, hasLength(4));
+ expect((bodyElement.nodes[0] as Element).localName, 'div');
+ expect((bodyElement.nodes[2] as Element).localName, 'span');
+ }
+ // it's OK to don't have DOCTYPE
+ expect(outputs[HTML_DOCUMENT_ERRORS], isEmpty);
+ }
}
« no previous file with comments | « pkg/analyzer/test/src/context/context_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698