| Index: pkg/polymer/test/build/common.dart
|
| diff --git a/pkg/polymer/test/build/common.dart b/pkg/polymer/test/build/common.dart
|
| index 91e6b11a76472965b4f235a83366ee4d9b63cab8..f97ddc09107f4b4231e89e770b4ac1b1b76c8c54 100644
|
| --- a/pkg/polymer/test/build/common.dart
|
| +++ b/pkg/polymer/test/build/common.dart
|
| @@ -36,8 +36,11 @@ class TestHelper implements PackageProvider {
|
| var resultSubscription;
|
| var logSubscription;
|
|
|
| - Future<Asset> getAsset(AssetId id) =>
|
| - new Future.value(new Asset.fromString(id, files[idToString(id)]));
|
| + Future<Asset> getAsset(AssetId id) {
|
| + var content = files[idToString(id)];
|
| + if (content == null) fail('error: requested $id, but $id is not available');
|
| + return new Future.value(new Asset.fromString(id, content));
|
| + }
|
|
|
| TestHelper(List<List<Transformer>> transformers, Map<String, String> files,
|
| this.messages)
|
| @@ -124,6 +127,10 @@ class TestHelper implements PackageProvider {
|
| testPhases(String testName, List<List<Transformer>> phases,
|
| Map<String, String> inputFiles, Map<String, String> expectedFiles,
|
| [List<String> expectedMessages, bool solo = false]) {
|
| +
|
| + // Include mock versions of the polymer library that can be used to test
|
| + // resolver-based code generation.
|
| + POLYMER_MOCKS.forEach((file, contents) { inputFiles[file] = contents; });
|
| (solo ? solo_test : test)(testName, () {
|
| var helper = new TestHelper(phases, inputFiles, expectedMessages)..run();
|
| return helper.checkAll(expectedFiles).whenComplete(() => helper.tearDown());
|
| @@ -137,3 +144,42 @@ const WEB_COMPONENTS_TAG =
|
| const INTEROP_TAG = '<script src="packages/browser/interop.js"></script>\n';
|
| const DART_JS_TAG = '<script src="packages/browser/dart.js"></script>';
|
|
|
| +const POLYMER_MOCKS = const {
|
| + 'polymer|lib/polymer.dart':
|
| + 'library polymer;\n'
|
| + 'import "dart:html";\n'
|
| + 'export "package:observe/observe.dart";\n' // for @observable
|
| + 'part "src/loader.dart";\n' // for @CustomTag and @initMethod
|
| + 'part "src/instance.dart";\n', // for @published and @ObserveProperty
|
| +
|
| + 'polymer|lib/src/loader.dart':
|
| + 'part of polymer;\n'
|
| + 'class CustomTag {\n'
|
| + ' final String tagName;\n'
|
| + ' const CustomTag(this.tagName);'
|
| + '}\n'
|
| + 'class InitMethodAnnotation { const InitMethodAnnotation(); }\n'
|
| + 'const initMethod = const InitMethodAnnotation();\n',
|
| +
|
| + 'polymer|lib/src/instance.dart':
|
| + 'part of polymer;\n'
|
| + 'class PublishedProperty { const PublishedProperty(); }\n'
|
| + 'const published = const PublishedProperty();\n'
|
| + 'class ObserveProperty { const ObserveProperty(); }\n'
|
| + 'abstract class Polymer {}\n'
|
| + 'class PolymerElement extends HtmlElement with Polymer {}\n',
|
| +
|
| + 'polymer|lib/init.dart':
|
| + 'library polymer.init;\n'
|
| + 'import "package:polymer/polymer.dart";\n'
|
| + 'main() {};\n',
|
| +
|
| + 'observe|lib/observe.dart':
|
| + 'library observe;\n'
|
| + 'export "src/metadata.dart";',
|
| +
|
| + 'observe|lib/src/metadata.dart':
|
| + 'library observe.src.metadata;\n'
|
| + 'class ObservableProperty { const ObservableProperty(); }\n'
|
| + 'const observable = const ObservableProperty();\n',
|
| +};
|
|
|