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

Side by Side Diff: packages/html/test/support.dart

Issue 2990843002: Removed fixed dependencies (Closed)
Patch Set: Created 3 years, 4 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
« no previous file with comments | « packages/html/test/run_all.dart ('k') | packages/isolate/.gitignore » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /// Support code for the tests in this directory. 1 /// Support code for the tests in this directory.
2 library support; 2 library support;
3 3
4 import 'dart:io'; 4 import 'dart:io';
5 import 'dart:collection'; 5 import 'dart:collection';
6 import 'package:path/path.dart' as path; 6 import 'package:path/path.dart' as path;
7 import 'package:html/src/treebuilder.dart'; 7 import 'package:html/src/treebuilder.dart';
8 import 'package:html/dom.dart'; 8 import 'package:html/dom.dart';
9 import 'package:html/dom_parsing.dart'; 9 import 'package:html/dom_parsing.dart';
10 10
11 typedef TreeBuilder TreeBuilderFactory(bool namespaceHTMLElements); 11 typedef TreeBuilder TreeBuilderFactory(bool namespaceHTMLElements);
12 12
13 Map _treeTypes; 13 Map<String, TreeBuilderFactory> _treeTypes;
14 Map<String, TreeBuilderFactory> get treeTypes { 14 Map<String, TreeBuilderFactory> get treeTypes {
15 if (_treeTypes == null) { 15 if (_treeTypes == null) {
16 // TODO(jmesserly): add DOM here once it's implemented 16 // TODO(jmesserly): add DOM here once it's implemented
17 _treeTypes = {"simpletree": (useNs) => new TreeBuilder(useNs)}; 17 _treeTypes = {"simpletree": (useNs) => new TreeBuilder(useNs)};
18 } 18 }
19 return _treeTypes; 19 return _treeTypes;
20 } 20 }
21 21
22 final testDataDir = Platform.script.resolve('data').toFilePath(); 22 final testDataDir = Platform.script.resolve('data').toFilePath();
23 23
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 _str.write(node); 126 _str.write(node);
127 visitChildren(node); 127 visitChildren(node);
128 } 128 }
129 129
130 visitChildren(Node node) { 130 visitChildren(Node node) {
131 indent += 2; 131 indent += 2;
132 for (var child in node.nodes) visit(child); 132 for (var child in node.nodes) visit(child);
133 indent -= 2; 133 indent -= 2;
134 } 134 }
135 135
136 visitDocument(node) { 136 visitDocument(node) => _visitDocumentOrFragment(node);
137
138 _visitDocumentOrFragment(node) {
137 indent += 1; 139 indent += 1;
138 for (var child in node.nodes) visit(child); 140 for (var child in node.nodes) visit(child);
139 indent -= 1; 141 indent -= 1;
140 } 142 }
141 143
142 visitDocumentFragment(DocumentFragment node) => visitDocument(node); 144 visitDocumentFragment(DocumentFragment node) =>
145 _visitDocumentOrFragment(node);
143 146
144 visitElement(Element node) { 147 visitElement(Element node) {
145 _newline(); 148 _newline();
146 _str.write(node); 149 _str.write(node);
147 if (node.attributes.length > 0) { 150 if (node.attributes.length > 0) {
148 indent += 2; 151 indent += 2;
149 var keys = new List.from(node.attributes.keys); 152 var keys = new List.from(node.attributes.keys);
150 keys.sort((x, y) => x.compareTo(y)); 153 keys.sort((x, y) => x.compareTo(y));
151 for (var key in keys) { 154 for (var key in keys) {
152 var v = node.attributes[key]; 155 var v = node.attributes[key];
153 if (key is AttributeName) { 156 if (key is AttributeName) {
154 AttributeName attr = key; 157 AttributeName attr = key;
155 key = "${attr.prefix} ${attr.name}"; 158 key = "${attr.prefix} ${attr.name}";
156 } 159 }
157 _newline(); 160 _newline();
158 _str.write('$key="$v"'); 161 _str.write('$key="$v"');
159 } 162 }
160 indent -= 2; 163 indent -= 2;
161 } 164 }
162 visitChildren(node); 165 visitChildren(node);
163 } 166 }
164 } 167 }
OLDNEW
« no previous file with comments | « packages/html/test/run_all.dart ('k') | packages/isolate/.gitignore » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698