| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** | 5 /** |
| 6 * Tests that we are generating a valid `dart:html` type for each element | 6 * Tests that we are generating a valid `dart:html` type for each element |
| 7 * field. This test is a bit goofy because it needs to run the `dart_analyzer`, | 7 * field. This test is a bit goofy because it needs to run the `dart_analyzer`, |
| 8 * but I can't think of an easier way to validate that the HTML types in our | 8 * but I can't think of an easier way to validate that the HTML types in our |
| 9 * table exist. | 9 * table exist. |
| 10 */ | 10 */ |
| 11 library html_type_test; | 11 library html_type_test; |
| 12 | 12 |
| 13 import 'dart:io'; | 13 import 'dart:io'; |
| 14 import 'package:html5lib/dom.dart'; | 14 import 'package:path/path.dart' as path; |
| 15 import 'package:pathos/path.dart' as path; | |
| 16 import 'package:unittest/compact_vm_config.dart'; | 15 import 'package:unittest/compact_vm_config.dart'; |
| 17 import 'package:unittest/unittest.dart'; | 16 import 'package:unittest/unittest.dart'; |
| 18 import 'package:web_ui/src/html5_setters.g.dart'; | 17 import 'package:web_ui/src/html5_setters.g.dart'; |
| 19 import 'package:web_ui/src/html5_utils.dart'; | 18 import 'package:web_ui/src/html5_utils.dart'; |
| 20 | 19 |
| 21 import 'testing.dart'; | |
| 22 | |
| 23 main() { | 20 main() { |
| 24 useCompactVMConfiguration(); | 21 useCompactVMConfiguration(); |
| 25 var dir = path.join( | 22 var dir = path.join( |
| 26 path.absolute(path.dirname(new Options().script)), 'data', 'out'); | 23 path.absolute(path.dirname(Platform.script.path)), 'data', 'out'); |
| 27 | 24 |
| 28 test('generate type test for tag -> element mapping', () { | 25 test('generate type test for tag -> element mapping', () { |
| 29 var code = new StringBuffer(); | 26 var code = new StringBuffer(); |
| 30 code.write('import "dart:html" as html;\n'); | 27 code.write('import "dart:html" as html;\n'); |
| 31 htmlElementNames.forEach((tag, className) { | 28 htmlElementNames.forEach((tag, className) { |
| 32 code.write('html.$className _$tag;\n'); | 29 code.write('html.$className _$tag;\n'); |
| 33 }); | 30 }); |
| 34 | 31 |
| 35 // Note: name is important for this to get picked up by run.sh | 32 // Note: name is important for this to get picked up by run.sh |
| 36 // We don't analyze here, but run.sh will analyze it. | 33 // We don't analyze here, but run.sh will analyze it. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 52 } | 49 } |
| 53 }); | 50 }); |
| 54 code.write('}\n'); | 51 code.write('}\n'); |
| 55 | 52 |
| 56 // Note: name is important for this to get picked up by run.sh | 53 // Note: name is important for this to get picked up by run.sh |
| 57 // We don't analyze here, but run.sh will analyze it. | 54 // We don't analyze here, but run.sh will analyze it. |
| 58 new File(path.join(dir, 'html5_utils_test_attr_bootstrap.dart')) | 55 new File(path.join(dir, 'html5_utils_test_attr_bootstrap.dart')) |
| 59 .writeAsStringSync(code.toString()); | 56 .writeAsStringSync(code.toString()); |
| 60 }); | 57 }); |
| 61 } | 58 } |
| OLD | NEW |