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

Unified Diff: test/html5_utils_test.dart

Issue 11315020: Add attribute information table so we generate correct setters. (Closed) Base URL: https://github.com/dart-lang/dart-web-components.git@master
Patch Set: Created 8 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
« lib/src/html5_utils.dart ('K') | « lib/src/html5_utils.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/html5_utils_test.dart
diff --git a/test/html5_utils_test.dart b/test/html5_utils_test.dart
index 7d0b27418d099ce8df05f98d7e28fe5657807bbb..daf1ae136c89a5dac2a2d8c5d14499f63f96e569 100644
--- a/test/html5_utils_test.dart
+++ b/test/html5_utils_test.dart
@@ -21,27 +21,45 @@ main() {
useVmConfiguration();
useMockMessages();
- test('types are in dart:html', () {
+ test('generate type test for tag -> element mapping', () {
var code = new StringBuffer();
code.add('import "dart:html" as html;\n');
htmlElementNames.forEach((tag, className) {
code.add('html.$className _$tag;\n');
});
- const generatedFile = 'data/output/html5_utils_test_generated.dart';
- new File(generatedFile).openSync(FileMode.WRITE)
+ // Note: name is important for this to get picked up by run.sh
+ // We don't analyze here, but run.sh will analyze it.
+ new File('data/output/html5_utils_test_tag_bootstrap.dart')
+ .openSync(FileMode.WRITE)
..writeStringSync(code.toString())
..close();
+ });
+
+ test('generate type test for attribute -> field mapping', () {
+ var code = new StringBuffer();
+ code.add('import "dart:html" as html;\n');
+ code.add('main() {\n');
+ htmlElementNames.forEach((tag, className) {
+ code.add('html.$className _$tag = null;\n');
+ });
+ var allTags = htmlElementNames.keys;
+ htmlAttributeTags.forEach((attr, tags) {
+ var renamed = elementFieldRenames[attr];
+ if (renamed != null) attr = renamed;
+
+ if (tags == allHtmlElements) tags = allTags;
+ for (var tag in tags) {
+ code.add('_$tag.$attr = null;\n');
+ }
+ });
+ code.add('}\n');
- // TODO(jmesserly): it would be good to run all of our
- // dart_analyzer tests in one batch.
- Process.run('dart_analyzer', '--fatal-warnings --fatal-type-errors '
- '--work data/output/analyzer/ $generatedFile'.split(' '))
- .then(expectAsync1((result) {
- expect(result.stdout, '', result.stdout);
- expect(result.stderr, '', result.stderr);
- expect(result.exitCode, 0, 'expected success, but got exit code '
- '${result.exitCode}');
- }));
+ // Note: name is important for this to get picked up by run.sh
+ // We don't analyze here, but run.sh will analyze it.
+ new File('data/output/html5_utils_test_attr_bootstrap.dart')
+ .openSync(FileMode.WRITE)
+ ..writeStringSync(code.toString())
+ ..close();
});
}
« lib/src/html5_utils.dart ('K') | « lib/src/html5_utils.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698