test(dart/transform): Update unit tests to expect code in <file>.template.dart
Closes #6711
This commit is contained in:
parent
8c36aa866a
commit
566d3ede04
|
@ -73,6 +73,17 @@ class TransformerOptions {
|
||||||
/// at any time.
|
/// at any time.
|
||||||
final bool lazyTransformers;
|
final bool lazyTransformers;
|
||||||
|
|
||||||
|
/// Whether to generate compiled templates.
|
||||||
|
///
|
||||||
|
/// This option is strictly for internal testing and is not available as an
|
||||||
|
/// option on the transformer.
|
||||||
|
/// Setting this to `false` means that our generated .template.dart files do
|
||||||
|
/// not have any compiled templates or change detectors defined in them.
|
||||||
|
/// These files will not be usable, but this allows us to test the code output
|
||||||
|
/// of the transformer without breaking when compiled template internals
|
||||||
|
/// change.
|
||||||
|
final bool genCompiledTemplates;
|
||||||
|
|
||||||
TransformerOptions._internal(
|
TransformerOptions._internal(
|
||||||
this.entryPoints,
|
this.entryPoints,
|
||||||
this.entryPointGlobs,
|
this.entryPointGlobs,
|
||||||
|
@ -80,13 +91,14 @@ class TransformerOptions {
|
||||||
this.mirrorMode,
|
this.mirrorMode,
|
||||||
this.initReflector,
|
this.initReflector,
|
||||||
this.annotationMatcher,
|
this.annotationMatcher,
|
||||||
{this.genChangeDetectionDebugInfo,
|
{this.formatCode,
|
||||||
this.reflectPropertiesAsAttributes,
|
this.genChangeDetectionDebugInfo,
|
||||||
this.platformDirectives,
|
this.genCompiledTemplates,
|
||||||
this.platformPipes,
|
|
||||||
this.inlineViews,
|
this.inlineViews,
|
||||||
this.lazyTransformers,
|
this.lazyTransformers,
|
||||||
this.formatCode});
|
this.platformDirectives,
|
||||||
|
this.platformPipes,
|
||||||
|
this.reflectPropertiesAsAttributes});
|
||||||
|
|
||||||
factory TransformerOptions(List<String> entryPoints,
|
factory TransformerOptions(List<String> entryPoints,
|
||||||
{String modeName: 'release',
|
{String modeName: 'release',
|
||||||
|
@ -95,6 +107,7 @@ class TransformerOptions {
|
||||||
List<ClassDescriptor> customAnnotationDescriptors: const [],
|
List<ClassDescriptor> customAnnotationDescriptors: const [],
|
||||||
bool inlineViews: false,
|
bool inlineViews: false,
|
||||||
bool genChangeDetectionDebugInfo: false,
|
bool genChangeDetectionDebugInfo: false,
|
||||||
|
bool genCompiledTemplates: true,
|
||||||
bool reflectPropertiesAsAttributes: false,
|
bool reflectPropertiesAsAttributes: false,
|
||||||
List<String> platformDirectives,
|
List<String> platformDirectives,
|
||||||
List<String> platformPipes,
|
List<String> platformPipes,
|
||||||
|
@ -108,6 +121,7 @@ class TransformerOptions {
|
||||||
return new TransformerOptions._internal(entryPoints, entryPointGlobs,
|
return new TransformerOptions._internal(entryPoints, entryPointGlobs,
|
||||||
modeName, mirrorMode, initReflector, annotationMatcher,
|
modeName, mirrorMode, initReflector, annotationMatcher,
|
||||||
genChangeDetectionDebugInfo: genChangeDetectionDebugInfo,
|
genChangeDetectionDebugInfo: genChangeDetectionDebugInfo,
|
||||||
|
genCompiledTemplates: genCompiledTemplates,
|
||||||
reflectPropertiesAsAttributes: reflectPropertiesAsAttributes,
|
reflectPropertiesAsAttributes: reflectPropertiesAsAttributes,
|
||||||
platformDirectives: platformDirectives,
|
platformDirectives: platformDirectives,
|
||||||
platformPipes: platformPipes,
|
platformPipes: platformPipes,
|
||||||
|
|
|
@ -4,6 +4,7 @@ import 'dart:async';
|
||||||
|
|
||||||
import 'package:barback/barback.dart';
|
import 'package:barback/barback.dart';
|
||||||
|
|
||||||
|
import 'package:angular2/src/compiler/source_module.dart';
|
||||||
import 'package:angular2/src/core/change_detection/interfaces.dart';
|
import 'package:angular2/src/core/change_detection/interfaces.dart';
|
||||||
import 'package:angular2/src/facade/lang.dart';
|
import 'package:angular2/src/facade/lang.dart';
|
||||||
import 'package:angular2/src/core/reflection/reflection.dart';
|
import 'package:angular2/src/core/reflection/reflection.dart';
|
||||||
|
|
|
@ -52,16 +52,11 @@ class TemplateCompiler extends Transformer implements LazyTransformer {
|
||||||
if (outputs != null) {
|
if (outputs != null) {
|
||||||
if (outputs.ngDeps != null) {
|
if (outputs.ngDeps != null) {
|
||||||
final buf = new StringBuffer();
|
final buf = new StringBuffer();
|
||||||
|
final templatesSrc =
|
||||||
|
options.genCompiledTemplates ? outputs.templatesSource : null;
|
||||||
writeTemplateFile(
|
writeTemplateFile(
|
||||||
new NgDepsWriter(buf), outputs.ngDeps, outputs.templatesSource);
|
new NgDepsWriter(buf), outputs.ngDeps, templatesSrc);
|
||||||
ngDepsCode = formatter.format(buf.toString());
|
ngDepsCode = formatter.format(buf.toString());
|
||||||
|
|
||||||
if (primaryId.path.endsWith('index.ng_meta.json')) {
|
|
||||||
final buf2 = new StringBuffer();
|
|
||||||
var writer = new NgDepsWriter(buf2);
|
|
||||||
outputs.ngDeps.imports.forEach(writer.writeImportModel);
|
|
||||||
print(buf2.toString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
transform.addOutput(
|
transform.addOutput(
|
||||||
|
|
|
@ -3,7 +3,7 @@ library web_foo;
|
||||||
import 'package:angular2/src/core/application.dart';
|
import 'package:angular2/src/core/application.dart';
|
||||||
import 'package:angular2/src/core/reflection/reflection.dart';
|
import 'package:angular2/src/core/reflection/reflection.dart';
|
||||||
import 'package:angular2/src/core/reflection/reflection_capabilities.dart';
|
import 'package:angular2/src/core/reflection/reflection_capabilities.dart';
|
||||||
import 'hello.ng_deps.dart' deferred as a; // ng_deps. Should be rewritten.
|
import 'hello.template.dart' deferred as a; // ng_deps. Should be rewritten.
|
||||||
import 'b.dart' deferred as b; // No ng_deps. Shouldn't be rewritten.
|
import 'b.dart' deferred as b; // No ng_deps. Shouldn't be rewritten.
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
|
|
@ -3,7 +3,7 @@ library web_foo;
|
||||||
import 'package:angular2/src/core/application.dart';
|
import 'package:angular2/src/core/application.dart';
|
||||||
import 'package:angular2/src/core/reflection/reflection.dart';
|
import 'package:angular2/src/core/reflection/reflection.dart';
|
||||||
import 'package:angular2/src/core/reflection/reflection_capabilities.dart';
|
import 'package:angular2/src/core/reflection/reflection_capabilities.dart';
|
||||||
import 'hello.ng_deps.dart' deferred as a;
|
import 'hello.template.dart' deferred as a;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
||||||
|
|
|
@ -130,7 +130,7 @@ void allTests() {
|
||||||
var linked = (await _testLink(reader, fooAssetId)).ngDeps;
|
var linked = (await _testLink(reader, fooAssetId)).ngDeps;
|
||||||
expect(linked).toBeNotNull();
|
expect(linked).toBeNotNull();
|
||||||
var linkedImport = linked.depImports
|
var linkedImport = linked.depImports
|
||||||
.firstWhere((i) => i.uri.endsWith('bar.ng_deps.dart'));
|
.firstWhere((i) => i.uri.endsWith('bar.template.dart'));
|
||||||
expect(linkedImport).toBeNotNull();
|
expect(linkedImport).toBeNotNull();
|
||||||
expect(linkedImport.prefix.startsWith('i')).toBeTrue();
|
expect(linkedImport.prefix.startsWith('i')).toBeTrue();
|
||||||
});
|
});
|
||||||
|
@ -145,7 +145,7 @@ void allTests() {
|
||||||
var linked = (await _testLink(reader, fooAssetId)).ngDeps;
|
var linked = (await _testLink(reader, fooAssetId)).ngDeps;
|
||||||
expect(linked).toBeNotNull();
|
expect(linked).toBeNotNull();
|
||||||
var linkedImport = linked.depImports
|
var linkedImport = linked.depImports
|
||||||
.firstWhere((i) => i.uri.endsWith('bar.ng_deps.dart'));
|
.firstWhere((i) => i.uri.endsWith('bar.template.dart'));
|
||||||
expect(linkedImport).toBeNotNull();
|
expect(linkedImport).toBeNotNull();
|
||||||
expect(linkedImport.prefix.startsWith('i')).toBeTrue();
|
expect(linkedImport.prefix.startsWith('i')).toBeTrue();
|
||||||
});
|
});
|
||||||
|
@ -163,7 +163,7 @@ void allTests() {
|
||||||
var linked = (await _testLink(reader, fooAssetId)).ngDeps;
|
var linked = (await _testLink(reader, fooAssetId)).ngDeps;
|
||||||
expect(linked).toBeNotNull();
|
expect(linked).toBeNotNull();
|
||||||
var linkedImport = linked.depImports.firstWhere(
|
var linkedImport = linked.depImports.firstWhere(
|
||||||
(i) => i.uri.endsWith('bar.ng_deps.dart'),
|
(i) => i.uri.endsWith('bar.template.dart'),
|
||||||
orElse: () => null);
|
orElse: () => null);
|
||||||
expect(linkedImport).toBeNull();
|
expect(linkedImport).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
|
@ -13,8 +13,10 @@ main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var formatter = new DartFormatter();
|
var formatter = new DartFormatter();
|
||||||
var transform = new AngularTransformerGroup(
|
var transform = new AngularTransformerGroup(new TransformerOptions(
|
||||||
new TransformerOptions(['web/index.dart'], formatCode: true));
|
['web/index.dart'],
|
||||||
|
formatCode: true,
|
||||||
|
genCompiledTemplates: false));
|
||||||
|
|
||||||
// Each test has its own directory for inputs & an `expected` directory for
|
// Each test has its own directory for inputs & an `expected` directory for
|
||||||
// expected outputs.
|
// expected outputs.
|
||||||
|
@ -56,10 +58,10 @@ void allTests() {
|
||||||
'a|web/bar.dart': 'simple_annotation_files/bar.dart'
|
'a|web/bar.dart': 'simple_annotation_files/bar.dart'
|
||||||
},
|
},
|
||||||
outputs: {
|
outputs: {
|
||||||
'a|web/bar.ng_deps.dart':
|
'a|web/bar.template.dart':
|
||||||
'simple_annotation_files/expected/bar.ng_deps.dart',
|
'simple_annotation_files/expected/bar.template.dart',
|
||||||
'a|web/index.ng_deps.dart':
|
'a|web/index.template.dart':
|
||||||
'simple_annotation_files/expected/index.ng_deps.dart'
|
'simple_annotation_files/expected/index.template.dart'
|
||||||
}),
|
}),
|
||||||
new IntegrationTestConfig(
|
new IntegrationTestConfig(
|
||||||
'should generate proper code for a Component with multiple deps.',
|
'should generate proper code for a Component with multiple deps.',
|
||||||
|
@ -69,7 +71,7 @@ void allTests() {
|
||||||
'a|web/bar.dart': 'two_deps_files/bar.dart'
|
'a|web/bar.dart': 'two_deps_files/bar.dart'
|
||||||
},
|
},
|
||||||
outputs: {
|
outputs: {
|
||||||
'a|web/bar.ng_deps.dart': 'two_deps_files/expected/bar.ng_deps.dart'
|
'a|web/bar.template.dart': 'two_deps_files/expected/bar.template.dart'
|
||||||
}),
|
}),
|
||||||
new IntegrationTestConfig(
|
new IntegrationTestConfig(
|
||||||
'should generate proper code for a Component declaring a '
|
'should generate proper code for a Component declaring a '
|
||||||
|
@ -80,7 +82,8 @@ void allTests() {
|
||||||
'a|web/bar.dart': 'list_of_types_files/bar.dart'
|
'a|web/bar.dart': 'list_of_types_files/bar.dart'
|
||||||
},
|
},
|
||||||
outputs: {
|
outputs: {
|
||||||
'a|web/bar.ng_deps.dart': 'list_of_types_files/expected/bar.ng_deps.dart'
|
'a|web/bar.template.dart':
|
||||||
|
'list_of_types_files/expected/bar.template.dart'
|
||||||
}),
|
}),
|
||||||
new IntegrationTestConfig(
|
new IntegrationTestConfig(
|
||||||
'should generate a factory for a class with no declared ctor.',
|
'should generate a factory for a class with no declared ctor.',
|
||||||
|
@ -89,7 +92,8 @@ void allTests() {
|
||||||
'a|web/bar.dart': 'synthetic_ctor_files/bar.dart'
|
'a|web/bar.dart': 'synthetic_ctor_files/bar.dart'
|
||||||
},
|
},
|
||||||
outputs: {
|
outputs: {
|
||||||
'a|web/bar.ng_deps.dart': 'synthetic_ctor_files/expected/bar.ng_deps.dart'
|
'a|web/bar.template.dart':
|
||||||
|
'synthetic_ctor_files/expected/bar.template.dart'
|
||||||
}),
|
}),
|
||||||
new IntegrationTestConfig('should preserve multiple annotations.', inputs: {
|
new IntegrationTestConfig('should preserve multiple annotations.', inputs: {
|
||||||
'a|web/index.dart': 'two_annotations_files/index.dart',
|
'a|web/index.dart': 'two_annotations_files/index.dart',
|
||||||
|
@ -97,8 +101,8 @@ void allTests() {
|
||||||
'angular2|lib/src/core/metadata.dart':
|
'angular2|lib/src/core/metadata.dart':
|
||||||
'../../../lib/src/core/metadata.dart'
|
'../../../lib/src/core/metadata.dart'
|
||||||
}, outputs: {
|
}, outputs: {
|
||||||
'a|web/bar.ng_deps.dart':
|
'a|web/bar.template.dart':
|
||||||
'two_annotations_files/expected/bar.ng_deps.dart'
|
'two_annotations_files/expected/bar.template.dart'
|
||||||
}),
|
}),
|
||||||
new IntegrationTestConfig(
|
new IntegrationTestConfig(
|
||||||
'should generate getters for output events defined on a Component.',
|
'should generate getters for output events defined on a Component.',
|
||||||
|
@ -107,7 +111,7 @@ void allTests() {
|
||||||
'a|web/bar.dart': 'event_getter_files/bar.dart'
|
'a|web/bar.dart': 'event_getter_files/bar.dart'
|
||||||
},
|
},
|
||||||
outputs: {
|
outputs: {
|
||||||
'a|web/bar.ng_deps.dart': 'event_getter_files/expected/bar.ng_deps.dart'
|
'a|web/bar.template.dart': 'event_getter_files/expected/bar.template.dart'
|
||||||
}),
|
}),
|
||||||
new IntegrationTestConfig(
|
new IntegrationTestConfig(
|
||||||
'should handle Directive dependencies declared on a View.',
|
'should handle Directive dependencies declared on a View.',
|
||||||
|
@ -117,7 +121,8 @@ void allTests() {
|
||||||
'a|web/bar.dart': 'directive_dep_files/bar.dart'
|
'a|web/bar.dart': 'directive_dep_files/bar.dart'
|
||||||
},
|
},
|
||||||
outputs: {
|
outputs: {
|
||||||
'a|web/bar.ng_deps.dart': 'directive_dep_files/expected/bar.ng_deps.dart'
|
'a|web/bar.template.dart':
|
||||||
|
'directive_dep_files/expected/bar.template.dart'
|
||||||
}),
|
}),
|
||||||
new IntegrationTestConfig(
|
new IntegrationTestConfig(
|
||||||
'should handle chained Directive dependencies declared on a View.',
|
'should handle chained Directive dependencies declared on a View.',
|
||||||
|
@ -128,18 +133,20 @@ void allTests() {
|
||||||
'a|web/baz.dart': 'directive_chain_files/baz.dart'
|
'a|web/baz.dart': 'directive_chain_files/baz.dart'
|
||||||
},
|
},
|
||||||
outputs: {
|
outputs: {
|
||||||
'a|web/bar.ng_deps.dart':
|
'a|web/bar.template.dart':
|
||||||
'directive_chain_files/expected/bar.ng_deps.dart'
|
'directive_chain_files/expected/bar.template.dart'
|
||||||
}),
|
}),
|
||||||
new IntegrationTestConfig(
|
new IntegrationTestConfig(
|
||||||
'should handle empty ng_deps files that define directive aliases.',
|
'should handle empty template files that define directive aliases.',
|
||||||
inputs: {
|
inputs: {
|
||||||
'a|web/foo.dart': 'empty_ng_deps_files/foo.dart',
|
'a|web/foo.dart': 'empty_ng_deps_files/foo.dart',
|
||||||
'a|web/bar.dart': 'empty_ng_deps_files/bar.dart'
|
'a|web/bar.dart': 'empty_ng_deps_files/bar.dart'
|
||||||
},
|
},
|
||||||
outputs: {
|
outputs: {
|
||||||
'a|web/foo.ng_deps.dart': 'empty_ng_deps_files/expected/foo.ng_deps.dart',
|
'a|web/foo.template.dart':
|
||||||
'a|web/bar.ng_deps.dart': 'empty_ng_deps_files/expected/bar.ng_deps.dart'
|
'empty_ng_deps_files/expected/foo.template.dart',
|
||||||
|
'a|web/bar.template.dart':
|
||||||
|
'empty_ng_deps_files/expected/bar.template.dart'
|
||||||
}),
|
}),
|
||||||
new IntegrationTestConfig(
|
new IntegrationTestConfig(
|
||||||
'should generate setters for annotated properties.',
|
'should generate setters for annotated properties.',
|
||||||
|
@ -147,8 +154,8 @@ void allTests() {
|
||||||
'a|web/bar.dart': 'queries_prop_annotation_files/bar.dart'
|
'a|web/bar.dart': 'queries_prop_annotation_files/bar.dart'
|
||||||
},
|
},
|
||||||
outputs: {
|
outputs: {
|
||||||
'a|web/bar.ng_deps.dart':
|
'a|web/bar.template.dart':
|
||||||
'queries_prop_annotation_files/expected/bar.ng_deps.dart'
|
'queries_prop_annotation_files/expected/bar.template.dart'
|
||||||
}),
|
}),
|
||||||
new IntegrationTestConfig(
|
new IntegrationTestConfig(
|
||||||
'should generate setters for `queries` values in Directives.',
|
'should generate setters for `queries` values in Directives.',
|
||||||
|
@ -156,14 +163,18 @@ void allTests() {
|
||||||
'a|web/bar.dart': 'queries_class_annotation_files/bar.dart'
|
'a|web/bar.dart': 'queries_class_annotation_files/bar.dart'
|
||||||
},
|
},
|
||||||
outputs: {
|
outputs: {
|
||||||
'a|web/bar.ng_deps.dart':
|
'a|web/bar.template.dart':
|
||||||
'queries_class_annotation_files/expected/bar.ng_deps.dart'
|
'queries_class_annotation_files/expected/bar.template.dart'
|
||||||
}),
|
}),
|
||||||
new IntegrationTestConfig(
|
new IntegrationTestConfig(
|
||||||
'should handle @override annotations in properties on Directives.',
|
'should handle @override annotations in properties on Directives.',
|
||||||
inputs: {'a|web/bar.dart': 'override_annotation_files/bar.dart'},
|
inputs: {
|
||||||
outputs:
|
'a|web/bar.dart': 'override_annotation_files/bar.dart'
|
||||||
{'a|web/bar.ng_deps.dart': 'override_annotation_files/expected/bar.ng_deps.dart'})
|
},
|
||||||
|
outputs: {
|
||||||
|
'a|web/bar.template.dart':
|
||||||
|
'override_annotation_files/expected/bar.template.dart'
|
||||||
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
var cache = {};
|
var cache = {};
|
||||||
|
@ -181,6 +192,9 @@ void allTests() {
|
||||||
config.assetPathToExpectedOutputPath.forEach((key, value) {
|
config.assetPathToExpectedOutputPath.forEach((key, value) {
|
||||||
config.assetPathToExpectedOutputPath[key] = cache.putIfAbsent(value, () {
|
config.assetPathToExpectedOutputPath[key] = cache.putIfAbsent(value, () {
|
||||||
var code = _readFile(value);
|
var code = _readFile(value);
|
||||||
|
if (code == null) {
|
||||||
|
throw 'Failed to read $value';
|
||||||
|
}
|
||||||
return value.endsWith('dart') ? formatter.format(code) : code;
|
return value.endsWith('dart') ? formatter.format(code) : code;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -208,8 +222,8 @@ void _testDeferredRewriter() {
|
||||||
inputs.addAll(commonInputs);
|
inputs.addAll(commonInputs);
|
||||||
inputs.keys.forEach((k) => inputs[k] = _readFile(inputs[k]));
|
inputs.keys.forEach((k) => inputs[k] = _readFile(inputs[k]));
|
||||||
var outputs = {
|
var outputs = {
|
||||||
'a|web/bar.ng_deps.dart':
|
'a|web/bar.template.dart':
|
||||||
_readFile('deferred_files/expected/bar.ng_deps.dart'),
|
_readFile('deferred_files/expected/bar.template.dart'),
|
||||||
'a|web/bar.dart': deferredOuts.barContents,
|
'a|web/bar.dart': deferredOuts.barContents,
|
||||||
'a|web/index.dart': deferredOuts.indexContents
|
'a|web/index.dart': deferredOuts.indexContents
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
library bar.ng_deps.dart;
|
library bar.template.dart;
|
||||||
|
|
||||||
import 'bar.dart';
|
import 'bar.dart';
|
||||||
import 'package:angular2/src/core/reflection/reflection.dart' as _ngRef;
|
import 'package:angular2/src/core/reflection/reflection.dart' as _ngRef;
|
||||||
import 'package:angular2/src/core/metadata.dart';
|
import 'package:angular2/src/core/metadata.dart';
|
||||||
import 'bar.template.dart' as _templates;
|
import 'package:angular2/src/core/metadata.template.dart' as i0;
|
||||||
import 'package:angular2/src/core/metadata.ng_deps.dart' as i0;
|
|
||||||
export 'bar.dart';
|
export 'bar.dart';
|
||||||
|
|
||||||
var _visited = false;
|
var _visited = false;
|
||||||
|
@ -17,7 +16,7 @@ void initReflector() {
|
||||||
new _ngRef.ReflectionInfo(const [
|
new _ngRef.ReflectionInfo(const [
|
||||||
const Component(selector: '[soup]'),
|
const Component(selector: '[soup]'),
|
||||||
const View(template: ''),
|
const View(template: ''),
|
||||||
_templates.hostViewFactory_MyComponent
|
hostViewFactory_MyComponent
|
||||||
], const [], () => new MyComponent()));
|
], const [], () => new MyComponent()));
|
||||||
i0.initReflector();
|
i0.initReflector();
|
||||||
}
|
}
|
|
@ -8,7 +8,7 @@ library angular2.test.transform.integration.deferred;
|
||||||
const indexContents = '''
|
const indexContents = '''
|
||||||
library web_foo;
|
library web_foo;
|
||||||
|
|
||||||
import 'index.ng_deps.dart' as ngStaticInit;import 'bar.ng_deps.dart' deferred as bar;
|
import 'index.template.dart' as ngStaticInit;import 'bar.template.dart' deferred as bar;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
bar.loadLibrary().then((_) {bar.initReflector();}).then((_) {
|
bar.loadLibrary().then((_) {bar.initReflector();}).then((_) {
|
||||||
|
@ -22,7 +22,7 @@ library bar;
|
||||||
|
|
||||||
import 'package:angular2/src/core/metadata.dart';
|
import 'package:angular2/src/core/metadata.dart';
|
||||||
|
|
||||||
import 'dep.ng_deps.dart' deferred as dep;
|
import 'dep.template.dart' deferred as dep;
|
||||||
|
|
||||||
@Component(selector: '[soup]')
|
@Component(selector: '[soup]')
|
||||||
@View(template: '')
|
@View(template: '')
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
library bar.ng_deps.dart;
|
library bar.template.dart;
|
||||||
|
|
||||||
import 'bar.dart';
|
import 'bar.dart';
|
||||||
import 'package:angular2/src/core/reflection/reflection.dart' as _ngRef;
|
import 'package:angular2/src/core/reflection/reflection.dart' as _ngRef;
|
||||||
import 'package:angular2/src/core/metadata.dart';
|
import 'package:angular2/src/core/metadata.dart';
|
||||||
import 'baz.dart';
|
import 'baz.dart';
|
||||||
import 'bar.template.dart' as _templates;
|
import 'package:angular2/src/core/metadata.template.dart' as i0;
|
||||||
import 'package:angular2/src/core/metadata.ng_deps.dart' as i0;
|
import 'baz.template.dart' as i1;
|
||||||
import 'baz.ng_deps.dart' as i1;
|
|
||||||
export 'bar.dart';
|
export 'bar.dart';
|
||||||
|
|
||||||
var _visited = false;
|
var _visited = false;
|
||||||
|
@ -19,7 +18,7 @@ void initReflector() {
|
||||||
new _ngRef.ReflectionInfo(const [
|
new _ngRef.ReflectionInfo(const [
|
||||||
const Component(selector: 'soup'),
|
const Component(selector: 'soup'),
|
||||||
const View(directives: [Foo], template: 'foo'),
|
const View(directives: [Foo], template: 'foo'),
|
||||||
_templates.hostViewFactory_MyComponent
|
hostViewFactory_MyComponent
|
||||||
], const [], () => new MyComponent()));
|
], const [], () => new MyComponent()));
|
||||||
i0.initReflector();
|
i0.initReflector();
|
||||||
i1.initReflector();
|
i1.initReflector();
|
|
@ -1,12 +1,11 @@
|
||||||
library bar.ng_deps.dart;
|
library bar.template.dart;
|
||||||
|
|
||||||
import 'bar.dart';
|
import 'bar.dart';
|
||||||
import 'package:angular2/src/core/reflection/reflection.dart' as _ngRef;
|
import 'package:angular2/src/core/reflection/reflection.dart' as _ngRef;
|
||||||
import 'package:angular2/src/core/metadata.dart';
|
import 'package:angular2/src/core/metadata.dart';
|
||||||
import 'foo.dart' as prefix;
|
import 'foo.dart' as prefix;
|
||||||
import 'bar.template.dart' as _templates;
|
import 'package:angular2/src/core/metadata.template.dart' as i0;
|
||||||
import 'package:angular2/src/core/metadata.ng_deps.dart' as i0;
|
import 'foo.template.dart' as i1;
|
||||||
import 'foo.ng_deps.dart' as i1;
|
|
||||||
export 'bar.dart';
|
export 'bar.dart';
|
||||||
|
|
||||||
var _visited = false;
|
var _visited = false;
|
||||||
|
@ -19,7 +18,7 @@ void initReflector() {
|
||||||
new _ngRef.ReflectionInfo(const [
|
new _ngRef.ReflectionInfo(const [
|
||||||
const Component(selector: 'soup'),
|
const Component(selector: 'soup'),
|
||||||
const View(directives: [prefix.Foo], template: 'foo'),
|
const View(directives: [prefix.Foo], template: 'foo'),
|
||||||
_templates.hostViewFactory_MyComponent
|
hostViewFactory_MyComponent
|
||||||
], const [], () => new MyComponent()));
|
], const [], () => new MyComponent()));
|
||||||
i0.initReflector();
|
i0.initReflector();
|
||||||
i1.initReflector();
|
i1.initReflector();
|
|
@ -1,12 +1,11 @@
|
||||||
library bar.ng_deps.dart;
|
library bar.template.dart;
|
||||||
|
|
||||||
import 'foo.dart';
|
import 'foo.dart';
|
||||||
import 'package:angular2/src/core/reflection/reflection.dart' as _ngRef;
|
import 'package:angular2/src/core/reflection/reflection.dart' as _ngRef;
|
||||||
import 'package:angular2/src/core/metadata.dart';
|
import 'package:angular2/src/core/metadata.dart';
|
||||||
import 'bar.dart';
|
import 'bar.dart';
|
||||||
import 'foo.template.dart' as _templates;
|
import 'package:angular2/src/core/metadata.template.dart' as i0;
|
||||||
import 'package:angular2/src/core/metadata.ng_deps.dart' as i0;
|
import 'bar.template.dart' as i1;
|
||||||
import 'bar.ng_deps.dart' as i1;
|
|
||||||
export 'foo.dart';
|
export 'foo.dart';
|
||||||
|
|
||||||
var _visited = false;
|
var _visited = false;
|
||||||
|
@ -19,7 +18,7 @@ void initReflector() {
|
||||||
new _ngRef.ReflectionInfo(const [
|
new _ngRef.ReflectionInfo(const [
|
||||||
const Component(selector: '[soup]'),
|
const Component(selector: '[soup]'),
|
||||||
const View(directives: const [directiveAlias], template: ''),
|
const View(directives: const [directiveAlias], template: ''),
|
||||||
_templates.hostViewFactory_MyComponent
|
hostViewFactory_MyComponent
|
||||||
], const [], () => new MyComponent()));
|
], const [], () => new MyComponent()));
|
||||||
i0.initReflector();
|
i0.initReflector();
|
||||||
i1.initReflector();
|
i1.initReflector();
|
|
@ -1,10 +1,9 @@
|
||||||
library bar.ng_deps.dart;
|
library bar.template.dart;
|
||||||
|
|
||||||
import 'bar.dart';
|
import 'bar.dart';
|
||||||
import 'package:angular2/src/core/reflection/reflection.dart' as _ngRef;
|
import 'package:angular2/src/core/reflection/reflection.dart' as _ngRef;
|
||||||
import 'package:angular2/src/core/metadata.dart';
|
import 'package:angular2/src/core/metadata.dart';
|
||||||
import 'bar.template.dart' as _templates;
|
import 'package:angular2/src/core/metadata.template.dart' as i0;
|
||||||
import 'package:angular2/src/core/metadata.ng_deps.dart' as i0;
|
|
||||||
export 'bar.dart';
|
export 'bar.dart';
|
||||||
|
|
||||||
var _visited = false;
|
var _visited = false;
|
||||||
|
@ -19,7 +18,7 @@ void initReflector() {
|
||||||
outputs: ['eventName1', 'eventName2: propName2'],
|
outputs: ['eventName1', 'eventName2: propName2'],
|
||||||
selector: '[soup]'),
|
selector: '[soup]'),
|
||||||
const View(template: ''),
|
const View(template: ''),
|
||||||
_templates.hostViewFactory_MyComponent
|
hostViewFactory_MyComponent
|
||||||
], const [], () => new MyComponent()))
|
], const [], () => new MyComponent()))
|
||||||
..registerGetters(
|
..registerGetters(
|
||||||
{'eventName1': (o) => o.eventName1, 'eventName2': (o) => o.eventName2});
|
{'eventName1': (o) => o.eventName1, 'eventName2': (o) => o.eventName2});
|
|
@ -1,11 +1,10 @@
|
||||||
library bar.ng_deps.dart;
|
library bar.template.dart;
|
||||||
|
|
||||||
import 'bar.dart';
|
import 'bar.dart';
|
||||||
import 'package:angular2/src/core/reflection/reflection.dart' as _ngRef;
|
import 'package:angular2/src/core/reflection/reflection.dart' as _ngRef;
|
||||||
import 'package:angular2/src/core/metadata.dart';
|
import 'package:angular2/src/core/metadata.dart';
|
||||||
import 'foo.dart';
|
import 'foo.dart';
|
||||||
import 'bar.template.dart' as _templates;
|
import 'package:angular2/src/core/metadata.template.dart' as i0;
|
||||||
import 'package:angular2/src/core/metadata.ng_deps.dart' as i0;
|
|
||||||
export 'bar.dart';
|
export 'bar.dart';
|
||||||
|
|
||||||
var _visited = false;
|
var _visited = false;
|
||||||
|
@ -18,7 +17,7 @@ void initReflector() {
|
||||||
new _ngRef.ReflectionInfo(const [
|
new _ngRef.ReflectionInfo(const [
|
||||||
const Component(componentServices: const [MyContext]),
|
const Component(componentServices: const [MyContext]),
|
||||||
const View(template: ''),
|
const View(template: ''),
|
||||||
_templates.hostViewFactory_MyComponent
|
hostViewFactory_MyComponent
|
||||||
], const [
|
], const [
|
||||||
const [MyContext]
|
const [MyContext]
|
||||||
], (MyContext c) => new MyComponent(c)));
|
], (MyContext c) => new MyComponent(c)));
|
|
@ -1,10 +1,9 @@
|
||||||
library bar.ng_deps.dart;
|
library bar.template.dart;
|
||||||
|
|
||||||
import 'bar.dart';
|
import 'bar.dart';
|
||||||
import 'package:angular2/src/core/reflection/reflection.dart' as _ngRef;
|
import 'package:angular2/src/core/reflection/reflection.dart' as _ngRef;
|
||||||
import 'package:angular2/src/core/metadata.dart';
|
import 'package:angular2/src/core/metadata.dart';
|
||||||
import 'bar.template.dart' as _templates;
|
import 'package:angular2/src/core/metadata.template.dart' as i0;
|
||||||
import 'package:angular2/src/core/metadata.ng_deps.dart' as i0;
|
|
||||||
export 'bar.dart';
|
export 'bar.dart';
|
||||||
|
|
||||||
var _visited = false;
|
var _visited = false;
|
||||||
|
@ -18,7 +17,7 @@ void initReflector() {
|
||||||
const [
|
const [
|
||||||
const Component(selector: '[soup]'),
|
const Component(selector: '[soup]'),
|
||||||
const View(template: ''),
|
const View(template: ''),
|
||||||
_templates.hostViewFactory_MyComponent
|
hostViewFactory_MyComponent
|
||||||
],
|
],
|
||||||
const [],
|
const [],
|
||||||
() => new MyComponent(),
|
() => new MyComponent(),
|
|
@ -1,10 +1,9 @@
|
||||||
library bar.ng_deps.dart;
|
library bar.template.dart;
|
||||||
|
|
||||||
import 'bar.dart';
|
import 'bar.dart';
|
||||||
import 'package:angular2/src/core/reflection/reflection.dart' as _ngRef;
|
import 'package:angular2/src/core/reflection/reflection.dart' as _ngRef;
|
||||||
import 'package:angular2/src/core/metadata.dart';
|
import 'package:angular2/src/core/metadata.dart';
|
||||||
import 'bar.template.dart' as _templates;
|
import 'package:angular2/src/core/metadata.template.dart' as i0;
|
||||||
import 'package:angular2/src/core/metadata.ng_deps.dart' as i0;
|
|
||||||
export 'bar.dart';
|
export 'bar.dart';
|
||||||
|
|
||||||
var _visited = false;
|
var _visited = false;
|
||||||
|
@ -19,7 +18,7 @@ void initReflector() {
|
||||||
queries: const {'queryField': const ContentChild('child')},
|
queries: const {'queryField': const ContentChild('child')},
|
||||||
selector: '[soup]'),
|
selector: '[soup]'),
|
||||||
const View(template: ''),
|
const View(template: ''),
|
||||||
_templates.hostViewFactory_MyComponent
|
hostViewFactory_MyComponent
|
||||||
], const [], () => new MyComponent()))
|
], const [], () => new MyComponent()))
|
||||||
..registerSetters({'queryField': (o, v) => o.queryField = v});
|
..registerSetters({'queryField': (o, v) => o.queryField = v});
|
||||||
i0.initReflector();
|
i0.initReflector();
|
|
@ -1,10 +1,9 @@
|
||||||
library bar.ng_deps.dart;
|
library bar.template.dart;
|
||||||
|
|
||||||
import 'bar.dart';
|
import 'bar.dart';
|
||||||
import 'package:angular2/src/core/reflection/reflection.dart' as _ngRef;
|
import 'package:angular2/src/core/reflection/reflection.dart' as _ngRef;
|
||||||
import 'package:angular2/src/core/metadata.dart';
|
import 'package:angular2/src/core/metadata.dart';
|
||||||
import 'bar.template.dart' as _templates;
|
import 'package:angular2/src/core/metadata.template.dart' as i0;
|
||||||
import 'package:angular2/src/core/metadata.ng_deps.dart' as i0;
|
|
||||||
export 'bar.dart';
|
export 'bar.dart';
|
||||||
|
|
||||||
var _visited = false;
|
var _visited = false;
|
||||||
|
@ -18,7 +17,7 @@ void initReflector() {
|
||||||
const [
|
const [
|
||||||
const Component(selector: '[soup]'),
|
const Component(selector: '[soup]'),
|
||||||
const View(template: ''),
|
const View(template: ''),
|
||||||
_templates.hostViewFactory_MyComponent
|
hostViewFactory_MyComponent
|
||||||
],
|
],
|
||||||
const [],
|
const [],
|
||||||
() => new MyComponent(),
|
() => new MyComponent(),
|
|
@ -1,10 +1,9 @@
|
||||||
library bar.ng_deps.dart;
|
library bar.template.dart;
|
||||||
|
|
||||||
import 'bar.dart';
|
import 'bar.dart';
|
||||||
import 'package:angular2/src/core/reflection/reflection.dart' as _ngRef;
|
import 'package:angular2/src/core/reflection/reflection.dart' as _ngRef;
|
||||||
import 'package:angular2/src/core/metadata.dart';
|
import 'package:angular2/src/core/metadata.dart';
|
||||||
import 'bar.template.dart' as _templates;
|
import 'package:angular2/src/core/metadata.template.dart' as i0;
|
||||||
import 'package:angular2/src/core/metadata.ng_deps.dart' as i0;
|
|
||||||
export 'bar.dart';
|
export 'bar.dart';
|
||||||
|
|
||||||
var _visited = false;
|
var _visited = false;
|
||||||
|
@ -16,7 +15,7 @@ void initReflector() {
|
||||||
MyComponent,
|
MyComponent,
|
||||||
new _ngRef.ReflectionInfo(const [
|
new _ngRef.ReflectionInfo(const [
|
||||||
const Component(selector: '[soup]', template: 'aa'),
|
const Component(selector: '[soup]', template: 'aa'),
|
||||||
_templates.hostViewFactory_MyComponent
|
hostViewFactory_MyComponent
|
||||||
], const [], () => new MyComponent()));
|
], const [], () => new MyComponent()));
|
||||||
i0.initReflector();
|
i0.initReflector();
|
||||||
}
|
}
|
|
@ -1,11 +1,11 @@
|
||||||
library web_foo.ng_deps.dart;
|
library web_foo.template.dart;
|
||||||
|
|
||||||
import 'index.dart';
|
import 'index.dart';
|
||||||
import 'package:angular2/src/core/reflection/reflection.dart' as _ngRef;
|
import 'package:angular2/src/core/reflection/reflection.dart' as _ngRef;
|
||||||
import 'package:angular2/bootstrap_static.dart' show bootstrapStatic;
|
import 'package:angular2/bootstrap_static.dart' show bootstrapStatic;
|
||||||
import 'package:angular2/src/core/reflection/reflection.dart';
|
import 'package:angular2/src/core/reflection/reflection.dart';
|
||||||
import 'bar.dart';
|
import 'bar.dart';
|
||||||
import 'bar.ng_deps.dart' as i0;
|
import 'bar.template.dart' as i0;
|
||||||
export 'index.dart';
|
export 'index.dart';
|
||||||
|
|
||||||
var _visited = false;
|
var _visited = false;
|
|
@ -1,10 +1,9 @@
|
||||||
library bar.ng_deps.dart;
|
library bar.template.dart;
|
||||||
|
|
||||||
import 'bar.dart';
|
import 'bar.dart';
|
||||||
import 'package:angular2/src/core/reflection/reflection.dart' as _ngRef;
|
import 'package:angular2/src/core/reflection/reflection.dart' as _ngRef;
|
||||||
import 'package:angular2/src/core/metadata.dart';
|
import 'package:angular2/src/core/metadata.dart';
|
||||||
import 'bar.template.dart' as _templates;
|
import 'package:angular2/src/core/metadata.template.dart' as i0;
|
||||||
import 'package:angular2/src/core/metadata.ng_deps.dart' as i0;
|
|
||||||
export 'bar.dart';
|
export 'bar.dart';
|
||||||
|
|
||||||
var _visited = false;
|
var _visited = false;
|
||||||
|
@ -17,7 +16,7 @@ void initReflector() {
|
||||||
new _ngRef.ReflectionInfo(const [
|
new _ngRef.ReflectionInfo(const [
|
||||||
const Component(selector: '[soup]'),
|
const Component(selector: '[soup]'),
|
||||||
const View(template: ''),
|
const View(template: ''),
|
||||||
_templates.hostViewFactory_MyComponent
|
hostViewFactory_MyComponent
|
||||||
], const [], () => new MyComponent()));
|
], const [], () => new MyComponent()));
|
||||||
i0.initReflector();
|
i0.initReflector();
|
||||||
}
|
}
|
|
@ -1,10 +1,9 @@
|
||||||
library bar.ng_deps.dart;
|
library bar.template.dart;
|
||||||
|
|
||||||
import 'bar.dart';
|
import 'bar.dart';
|
||||||
import 'package:angular2/src/core/reflection/reflection.dart' as _ngRef;
|
import 'package:angular2/src/core/reflection/reflection.dart' as _ngRef;
|
||||||
import 'package:angular2/src/core/metadata.dart';
|
import 'package:angular2/src/core/metadata.dart';
|
||||||
import 'bar.template.dart' as _templates;
|
import 'package:angular2/src/core/metadata.template.dart' as i0;
|
||||||
import 'package:angular2/src/core/metadata.ng_deps.dart' as i0;
|
|
||||||
export 'bar.dart';
|
export 'bar.dart';
|
||||||
|
|
||||||
var _visited = false;
|
var _visited = false;
|
||||||
|
@ -17,7 +16,7 @@ void initReflector() {
|
||||||
new _ngRef.ReflectionInfo(const [
|
new _ngRef.ReflectionInfo(const [
|
||||||
const Component(selector: '[soup]'),
|
const Component(selector: '[soup]'),
|
||||||
const View(template: 'Salad: {{myNum}} is awesome'),
|
const View(template: 'Salad: {{myNum}} is awesome'),
|
||||||
_templates.hostViewFactory_MyComponent
|
hostViewFactory_MyComponent
|
||||||
], const [], () => new MyComponent()));
|
], const [], () => new MyComponent()));
|
||||||
i0.initReflector();
|
i0.initReflector();
|
||||||
}
|
}
|
|
@ -1,11 +1,10 @@
|
||||||
library bar.ng_deps.dart;
|
library bar.template.dart;
|
||||||
|
|
||||||
import 'bar.dart';
|
import 'bar.dart';
|
||||||
import 'package:angular2/src/core/reflection/reflection.dart' as _ngRef;
|
import 'package:angular2/src/core/reflection/reflection.dart' as _ngRef;
|
||||||
import 'package:angular2/src/core/metadata.dart';
|
import 'package:angular2/src/core/metadata.dart';
|
||||||
import 'foo.dart' as prefix;
|
import 'foo.dart' as prefix;
|
||||||
import 'bar.template.dart' as _templates;
|
import 'package:angular2/src/core/metadata.template.dart' as i0;
|
||||||
import 'package:angular2/src/core/metadata.ng_deps.dart' as i0;
|
|
||||||
export 'bar.dart';
|
export 'bar.dart';
|
||||||
|
|
||||||
var _visited = false;
|
var _visited = false;
|
||||||
|
@ -19,7 +18,7 @@ void initReflector() {
|
||||||
const [
|
const [
|
||||||
const Component(selector: 'soup'),
|
const Component(selector: 'soup'),
|
||||||
const View(template: ''),
|
const View(template: ''),
|
||||||
_templates.hostViewFactory_MyComponent
|
hostViewFactory_MyComponent
|
||||||
],
|
],
|
||||||
const [
|
const [
|
||||||
const [prefix.MyContext],
|
const [prefix.MyContext],
|
|
@ -11,7 +11,7 @@ library angular2.test.transform.reflection_remover.reflection_remover_files;
|
||||||
var code = """
|
var code = """
|
||||||
library web_foo;
|
library web_foo;
|
||||||
|
|
||||||
import 'package:angular2/bootstrap_static.dart';import 'index.ng_deps.dart' as ngStaticInit;
|
import 'package:angular2/bootstrap_static.dart';import 'index.template.dart' as ngStaticInit;
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
var appRef = await bootstrapStatic(MyComponent, null, () { ngStaticInit.initReflector(); });
|
var appRef = await bootstrapStatic(MyComponent, null, () { ngStaticInit.initReflector(); });
|
||||||
|
|
|
@ -11,7 +11,7 @@ library angular2.test.transform.debug_reflection_remover_files;
|
||||||
var code = """
|
var code = """
|
||||||
library web_foo;
|
library web_foo;
|
||||||
|
|
||||||
import 'package:angular2/bootstrap.dart';import 'index.ng_deps.dart' as ngStaticInit;
|
import 'package:angular2/bootstrap.dart';import 'index.template.dart' as ngStaticInit;
|
||||||
import 'package:angular2/src/core/reflection/reflection.dart';
|
import 'package:angular2/src/core/reflection/reflection.dart';
|
||||||
import 'package:angular2/src/core/reflection/debug_reflection_capabilities.dart';
|
import 'package:angular2/src/core/reflection/debug_reflection_capabilities.dart';
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ library angular2.test.transform.reflection_remover.debug_mirrors_files.expected;
|
||||||
var code = """
|
var code = """
|
||||||
library web_foo;
|
library web_foo;
|
||||||
|
|
||||||
import 'package:angular2/bootstrap_static.dart';import 'index.ng_deps.dart' as ngStaticInit;
|
import 'package:angular2/bootstrap_static.dart';import 'index.template.dart' as ngStaticInit;
|
||||||
import 'package:angular2/src/core/reflection/reflection.dart';
|
import 'package:angular2/src/core/reflection/reflection.dart';
|
||||||
import 'package:angular2/src/core/reflection/debug_reflection_capabilities.dart';
|
import 'package:angular2/src/core/reflection/debug_reflection_capabilities.dart';
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ library angular2.test.transform.reflection_remover.function_annotation_files;
|
||||||
const code = """
|
const code = """
|
||||||
library web_foo;
|
library web_foo;
|
||||||
|
|
||||||
import 'package:angular2/bootstrap_static.dart';import 'index.ng_deps.dart' as ngStaticInit;
|
import 'package:angular2/bootstrap_static.dart';import 'index.template.dart' as ngStaticInit;
|
||||||
import 'package:angular2/src/core/reflection/reflection.dart';
|
import 'package:angular2/src/core/reflection/reflection.dart';
|
||||||
/*import 'package:angular2/src/core/reflection/reflection_capabilities.dart';*/
|
/*import 'package:angular2/src/core/reflection/reflection_capabilities.dart';*/
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ library angular2.test.transform.reflection_remover.method_annotation_files;
|
||||||
const code = """
|
const code = """
|
||||||
library web_foo;
|
library web_foo;
|
||||||
|
|
||||||
import 'package:angular2/bootstrap_static.dart';import 'index.ng_deps.dart' as ngStaticInit;
|
import 'package:angular2/bootstrap_static.dart';import 'index.template.dart' as ngStaticInit;
|
||||||
|
|
||||||
class TestBootstrapper {
|
class TestBootstrapper {
|
||||||
@AngularEntrypoint("Method entrypoint")
|
@AngularEntrypoint("Method entrypoint")
|
||||||
|
|
|
@ -11,7 +11,7 @@ library angular2.test.transform.reflection_remover.reflection_remover_files;
|
||||||
var code = """
|
var code = """
|
||||||
library web_foo;
|
library web_foo;
|
||||||
|
|
||||||
import 'package:angular2/bootstrap_static.dart';import 'index.ng_deps.dart' as ngStaticInit;
|
import 'package:angular2/bootstrap_static.dart';import 'index.template.dart' as ngStaticInit;
|
||||||
import 'package:angular2/src/core/reflection/reflection.dart';
|
import 'package:angular2/src/core/reflection/reflection.dart';
|
||||||
/*import 'package:angular2/src/core/reflection/reflection_capabilities.dart';*/
|
/*import 'package:angular2/src/core/reflection/reflection_capabilities.dart';*/
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ library angular2.test.transform.reflection_remover.verbose_files.expected;
|
||||||
var code = """
|
var code = """
|
||||||
library web_foo;
|
library web_foo;
|
||||||
|
|
||||||
import 'package:angular2/bootstrap_static.dart';import 'index.ng_deps.dart' as ngStaticInit;
|
import 'package:angular2/bootstrap_static.dart';import 'index.template.dart' as ngStaticInit;
|
||||||
import 'package:angular2/src/core/reflection/reflection.dart';
|
import 'package:angular2/src/core/reflection/reflection.dart';
|
||||||
import 'package:angular2/src/core/reflection/debug_reflection_capabilities.dart';
|
import 'package:angular2/src/core/reflection/debug_reflection_capabilities.dart';
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,10 @@ import 'package:guinness/guinness.dart';
|
||||||
import 'package:angular2/src/core/change_detection/codegen_name_util.dart'
|
import 'package:angular2/src/core/change_detection/codegen_name_util.dart'
|
||||||
show CONTEXT_ACCESSOR;
|
show CONTEXT_ACCESSOR;
|
||||||
import 'package:angular2/src/platform/server/html_adapter.dart';
|
import 'package:angular2/src/platform/server/html_adapter.dart';
|
||||||
import 'package:angular2/src/transform/template_compiler/generator.dart';
|
import 'package:angular2/src/transform/common/code/ng_deps_code.dart';
|
||||||
|
import 'package:angular2/src/transform/common/code/source_module.dart';
|
||||||
import 'package:angular2/src/transform/common/zone.dart' as zone;
|
import 'package:angular2/src/transform/common/zone.dart' as zone;
|
||||||
|
import 'package:angular2/src/transform/template_compiler/generator.dart';
|
||||||
|
|
||||||
import '../common/compile_directive_metadata/ng_for.ng_meta.dart' as ngMeta;
|
import '../common/compile_directive_metadata/ng_for.ng_meta.dart' as ngMeta;
|
||||||
import '../common/ng_meta_helper.dart';
|
import '../common/ng_meta_helper.dart';
|
||||||
|
@ -109,7 +111,7 @@ void allTests() {
|
||||||
|
|
||||||
final outputs = await process(fooAssetId);
|
final outputs = await process(fooAssetId);
|
||||||
// TODO(kegluenq): Does this next line need to be updated as well?
|
// TODO(kegluenq): Does this next line need to be updated as well?
|
||||||
expect(outputs.templatesCode).not.toContain('notifyDispatcher');
|
expect(_generatedCode(outputs)).not.toContain('notifyDispatcher');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should parse simple expressions in inline templates.', () async {
|
it('should parse simple expressions in inline templates.', () async {
|
||||||
|
@ -121,14 +123,11 @@ void allTests() {
|
||||||
final outputs = await process(fooAssetId);
|
final outputs = await process(fooAssetId);
|
||||||
final ngDeps = outputs.ngDeps;
|
final ngDeps = outputs.ngDeps;
|
||||||
expect(ngDeps).toBeNotNull();
|
expect(ngDeps).toBeNotNull();
|
||||||
expect(ngDeps.imports).toContain(new ImportModel()
|
|
||||||
..uri = 'foo.template.dart'
|
|
||||||
..prefix = '_templates');
|
|
||||||
expect(ngDeps.reflectables.first.annotations)
|
expect(ngDeps.reflectables.first.annotations)
|
||||||
.toContain(new AnnotationModel()
|
.toContain(new AnnotationModel()
|
||||||
..name = '_templates.hostViewFactory_FooComponent'
|
..name = 'hostViewFactory_FooComponent'
|
||||||
..isConstObject = true);
|
..isConstObject = true);
|
||||||
expect(outputs.templatesCode)
|
expect(_generatedCode(outputs))
|
||||||
..toContain('$CONTEXT_ACCESSOR.greeting')
|
..toContain('$CONTEXT_ACCESSOR.greeting')
|
||||||
..toContain('$CONTEXT_ACCESSOR.b');
|
..toContain('$CONTEXT_ACCESSOR.b');
|
||||||
});
|
});
|
||||||
|
@ -142,14 +141,11 @@ void allTests() {
|
||||||
final outputs = await process(fooAssetId);
|
final outputs = await process(fooAssetId);
|
||||||
final ngDeps = outputs.ngDeps;
|
final ngDeps = outputs.ngDeps;
|
||||||
expect(ngDeps).toBeNotNull();
|
expect(ngDeps).toBeNotNull();
|
||||||
expect(ngDeps.imports).toContain(new ImportModel()
|
|
||||||
..uri = 'foo.template.dart'
|
|
||||||
..prefix = '_templates');
|
|
||||||
expect(ngDeps.reflectables.first.annotations)
|
expect(ngDeps.reflectables.first.annotations)
|
||||||
.toContain(new AnnotationModel()
|
.toContain(new AnnotationModel()
|
||||||
..name = '_templates.hostViewFactory_FooComponent'
|
..name = 'hostViewFactory_FooComponent'
|
||||||
..isConstObject = true);
|
..isConstObject = true);
|
||||||
expect(outputs.templatesCode)..toContain('$CONTEXT_ACCESSOR.action()');
|
expect(_generatedCode(outputs))..toContain('$CONTEXT_ACCESSOR.action()');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should parse `View` directives with a single dependency.', () async {
|
it('should parse `View` directives with a single dependency.', () async {
|
||||||
|
@ -172,15 +168,12 @@ void allTests() {
|
||||||
final outputs = await process(fooAssetId);
|
final outputs = await process(fooAssetId);
|
||||||
final ngDeps = outputs.ngDeps;
|
final ngDeps = outputs.ngDeps;
|
||||||
expect(ngDeps).toBeNotNull();
|
expect(ngDeps).toBeNotNull();
|
||||||
expect(ngDeps.imports).toContain(new ImportModel()
|
|
||||||
..uri = 'foo.template.dart'
|
|
||||||
..prefix = '_templates');
|
|
||||||
expect(ngDeps.reflectables.first.annotations)
|
expect(ngDeps.reflectables.first.annotations)
|
||||||
.toContain(new AnnotationModel()
|
.toContain(new AnnotationModel()
|
||||||
..name = '_templates.hostViewFactory_FooComponent'
|
..name = 'hostViewFactory_FooComponent'
|
||||||
..isConstObject = true);
|
..isConstObject = true);
|
||||||
|
|
||||||
expect(outputs.templatesCode)
|
expect(_generatedCode(outputs))
|
||||||
..toContain("import 'bar.dart'")
|
..toContain("import 'bar.dart'")
|
||||||
..toContain("import 'bar.template.dart'");
|
..toContain("import 'bar.template.dart'");
|
||||||
});
|
});
|
||||||
|
@ -206,15 +199,12 @@ void allTests() {
|
||||||
final outputs = await process(fooAssetId);
|
final outputs = await process(fooAssetId);
|
||||||
final ngDeps = outputs.ngDeps;
|
final ngDeps = outputs.ngDeps;
|
||||||
expect(ngDeps).toBeNotNull();
|
expect(ngDeps).toBeNotNull();
|
||||||
expect(ngDeps.imports).toContain(new ImportModel()
|
|
||||||
..uri = 'foo.template.dart'
|
|
||||||
..prefix = '_templates');
|
|
||||||
expect(ngDeps.reflectables.first.annotations)
|
expect(ngDeps.reflectables.first.annotations)
|
||||||
.toContain(new AnnotationModel()
|
.toContain(new AnnotationModel()
|
||||||
..name = '_templates.hostViewFactory_FooComponent'
|
..name = 'hostViewFactory_FooComponent'
|
||||||
..isConstObject = true);
|
..isConstObject = true);
|
||||||
|
|
||||||
expect(outputs.templatesCode)
|
expect(_generatedCode(outputs))
|
||||||
..toContain("import 'bar.dart'")
|
..toContain("import 'bar.dart'")
|
||||||
..toContain("import 'bar.template.dart'");
|
..toContain("import 'bar.template.dart'");
|
||||||
});
|
});
|
||||||
|
@ -238,15 +228,12 @@ void allTests() {
|
||||||
final outputs = await process(fooAssetId);
|
final outputs = await process(fooAssetId);
|
||||||
final ngDeps = outputs.ngDeps;
|
final ngDeps = outputs.ngDeps;
|
||||||
expect(ngDeps).toBeNotNull();
|
expect(ngDeps).toBeNotNull();
|
||||||
expect(ngDeps.imports).toContain(new ImportModel()
|
|
||||||
..uri = 'foo.template.dart'
|
|
||||||
..prefix = '_templates');
|
|
||||||
expect(ngDeps.reflectables.first.annotations)
|
expect(ngDeps.reflectables.first.annotations)
|
||||||
.toContain(new AnnotationModel()
|
.toContain(new AnnotationModel()
|
||||||
..name = '_templates.hostViewFactory_FooComponent'
|
..name = 'hostViewFactory_FooComponent'
|
||||||
..isConstObject = true);
|
..isConstObject = true);
|
||||||
|
|
||||||
expect(outputs.templatesCode)
|
expect(_generatedCode(outputs))
|
||||||
..toContain("import 'bar.dart'")
|
..toContain("import 'bar.dart'")
|
||||||
..toContain("import 'bar.template.dart'");
|
..toContain("import 'bar.template.dart'");
|
||||||
});
|
});
|
||||||
|
@ -260,7 +247,7 @@ void allTests() {
|
||||||
final firstOutputs = await process(fooAssetId);
|
final firstOutputs = await process(fooAssetId);
|
||||||
final secondOutputs = await process(fooAssetId);
|
final secondOutputs = await process(fooAssetId);
|
||||||
expect(firstOutputs.ngDeps).toEqual(secondOutputs.ngDeps);
|
expect(firstOutputs.ngDeps).toEqual(secondOutputs.ngDeps);
|
||||||
expect(firstOutputs.templatesCode).toEqual(secondOutputs.templatesCode);
|
expect(_generatedCode(firstOutputs)).toEqual(_generatedCode(secondOutputs));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should generate getters for Component#outputs.', () async {
|
it('should generate getters for Component#outputs.', () async {
|
||||||
|
@ -370,7 +357,7 @@ void allTests() {
|
||||||
platformDirectives: ['package:a/bar.dart#PLATFORM']);
|
platformDirectives: ['package:a/bar.dart#PLATFORM']);
|
||||||
final ngDeps = outputs.ngDeps;
|
final ngDeps = outputs.ngDeps;
|
||||||
expect(ngDeps).toBeNotNull();
|
expect(ngDeps).toBeNotNull();
|
||||||
expect(outputs.templatesCode)
|
expect(_generatedCode(outputs))
|
||||||
..toBeNotNull()
|
..toBeNotNull()
|
||||||
..toContain(barComponentMeta.template.template);
|
..toContain(barComponentMeta.template.template);
|
||||||
});
|
});
|
||||||
|
@ -389,7 +376,7 @@ void allTests() {
|
||||||
platformDirectives: ['package:a/bar.dart#PLATFORM']);
|
platformDirectives: ['package:a/bar.dart#PLATFORM']);
|
||||||
final ngDeps = outputs.ngDeps;
|
final ngDeps = outputs.ngDeps;
|
||||||
expect(ngDeps).toBeNotNull();
|
expect(ngDeps).toBeNotNull();
|
||||||
expect(outputs.templatesCode)
|
expect(_generatedCode(outputs))
|
||||||
..toBeNotNull()
|
..toBeNotNull()
|
||||||
..toContain(barComponentMeta.template.template);
|
..toContain(barComponentMeta.template.template);
|
||||||
});
|
});
|
||||||
|
@ -440,7 +427,7 @@ void allTests() {
|
||||||
|
|
||||||
final outputs = await process(fooAssetId);
|
final outputs = await process(fooAssetId);
|
||||||
|
|
||||||
expect(outputs.templatesCode)
|
expect(_generatedCode(outputs))
|
||||||
..toContain("import 'bar.dart'")
|
..toContain("import 'bar.dart'")
|
||||||
..toContain(barPipeMeta.name);
|
..toContain(barPipeMeta.name);
|
||||||
});
|
});
|
||||||
|
@ -455,12 +442,19 @@ void allTests() {
|
||||||
final outputs = await process(fooAssetId,
|
final outputs = await process(fooAssetId,
|
||||||
platformPipes: ['package:a/bar.dart#PLATFORM']);
|
platformPipes: ['package:a/bar.dart#PLATFORM']);
|
||||||
|
|
||||||
expect(outputs.templatesCode)
|
expect(_generatedCode(outputs))
|
||||||
..toContain("import 'bar.dart'")
|
..toContain("import 'bar.dart'")
|
||||||
..toContain(barPipeMeta.name);
|
..toContain(barPipeMeta.name);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String _generatedCode(Outputs outputs) {
|
||||||
|
final StringBuffer buf = new StringBuffer();
|
||||||
|
final writer = new NgDepsWriter(buf);
|
||||||
|
writeTemplateFile(writer, outputs.ngDeps, outputs.templatesSource);
|
||||||
|
return buf.toString();
|
||||||
|
}
|
||||||
|
|
||||||
void _formatThenExpectEquals(String actual, String expected) {
|
void _formatThenExpectEquals(String actual, String expected) {
|
||||||
expect(formatter.format(actual)).toEqual(formatter.format(expected));
|
expect(formatter.format(actual)).toEqual(formatter.format(expected));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue