diff --git a/modules/angular2/test/core/compiler/integration_dart_spec.dart b/modules/angular2/test/core/compiler/integration_dart_spec.dart
index 229c887ee3..73dccc33e7 100644
--- a/modules/angular2/test/core/compiler/integration_dart_spec.dart
+++ b/modules/angular2/test/core/compiler/integration_dart_spec.dart
@@ -48,7 +48,7 @@ main() {
tb
.overrideView(
Dummy,
- new View(
+ new ViewMetadata(
template:
'',
directives: [TypeLiteralComponent]))
@@ -69,7 +69,7 @@ main() {
tb
.overrideView(
Dummy,
- new View(
+ new ViewMetadata(
template: '',
directives: [ThrowingComponent]))
.createAsync(Dummy)
@@ -86,7 +86,7 @@ main() {
tb
.overrideView(
Dummy,
- new View(
+ new ViewMetadata(
template: '',
directives: [ThrowingComponent2]))
.createAsync(Dummy)
@@ -105,7 +105,7 @@ main() {
tb
.overrideView(
Dummy,
- new View(
+ new ViewMetadata(
template: '',
directives: [PropertyAccess]))
.createAsync(Dummy)
@@ -123,7 +123,7 @@ main() {
tb
.overrideView(
Dummy,
- new View(
+ new ViewMetadata(
template: '',
directives: [NoPropertyAccess]))
.createAsync(Dummy)
@@ -142,7 +142,7 @@ main() {
tb
.overrideView(
Dummy,
- new View(
+ new ViewMetadata(
template: '''''',
directives: [OnChangeComponent]))
.createAsync(Dummy)
@@ -164,7 +164,7 @@ main() {
tcb
.overrideView(
Dummy,
- new View(
+ new ViewMetadata(
template:
'''''',
directives: [ComponentWithObservableList]))
diff --git a/modules/angular2/test/core/compiler/projection_integration_spec.ts b/modules/angular2/test/core/compiler/projection_integration_spec.ts
index b93fdc33b1..34624a8ddc 100644
--- a/modules/angular2/test/core/compiler/projection_integration_spec.ts
+++ b/modules/angular2/test/core/compiler/projection_integration_spec.ts
@@ -24,9 +24,6 @@ import {
import {DOM} from 'angular2/src/dom/dom_adapter';
import {
- Component,
- Directive,
- View,
forwardRef,
ViewContainerRef,
ElementRef,
@@ -34,6 +31,7 @@ import {
bind,
ViewEncapsulation
} from 'angular2/angular2';
+import {Component, Directive, View, ViewMetadata} from 'angular2/metadata';
import {MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE} from 'angular2/src/render/render';
@@ -41,7 +39,7 @@ export function main() {
describe('projection', () => {
it('should support simple components',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
- tcb.overrideView(MainComp, new View({
+ tcb.overrideView(MainComp, new ViewMetadata({
template: '' +
'A
' +
'',
@@ -56,7 +54,7 @@ export function main() {
it('should support simple components with text interpolation as direct children',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
- tcb.overrideView(MainComp, new View({
+ tcb.overrideView(MainComp, new ViewMetadata({
template: '{{\'START(\'}}' +
'{{text}}' +
'{{\')END\'}}',
@@ -76,10 +74,11 @@ export function main() {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideView(
Simple,
- new View(
+ new ViewMetadata(
{template: 'SIMPLE(
)', directives: []}))
- .overrideView(MainComp,
- new View({template: '{{text}}', directives: [Simple]}))
+ .overrideView(
+ MainComp,
+ new ViewMetadata({template: '{{text}}', directives: [Simple]}))
.createAsync(MainComp)
.then((main) => {
@@ -94,13 +93,14 @@ export function main() {
it('should support projecting text interpolation to a non bound element with other bound elements after it',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideView(
- Simple, new View({
+ Simple, new ViewMetadata({
template:
'SIMPLE(
EL
)',
directives: []
}))
- .overrideView(MainComp,
- new View({template: '{{text}}', directives: [Simple]}))
+ .overrideView(
+ MainComp,
+ new ViewMetadata({template: '{{text}}', directives: [Simple]}))
.createAsync(MainComp)
.then((main) => {
@@ -113,7 +113,8 @@ export function main() {
it('should not show the light dom even if there is no content tag',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
- tcb.overrideView(MainComp, new View({template: 'A', directives: [Empty]}))
+ tcb.overrideView(MainComp,
+ new ViewMetadata({template: 'A', directives: [Empty]}))
.createAsync(MainComp)
.then((main) => {
@@ -124,7 +125,7 @@ export function main() {
it('should support multiple content tags',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
- tcb.overrideView(MainComp, new View({
+ tcb.overrideView(MainComp, new ViewMetadata({
template: '' +
'B
' +
'C
' +
@@ -142,7 +143,7 @@ export function main() {
it('should redistribute only direct children',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
- tcb.overrideView(MainComp, new View({
+ tcb.overrideView(MainComp, new ViewMetadata({
template: '' +
'' +
'C
' +
@@ -159,7 +160,7 @@ export function main() {
it("should redistribute direct child viewcontainers when the light dom changes",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
- tcb.overrideView(MainComp, new View({
+ tcb.overrideView(MainComp, new ViewMetadata({
template: '' +
'A1
' +
'B
' +
@@ -185,7 +186,7 @@ export function main() {
it("should support nested components",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
- tcb.overrideView(MainComp, new View({
+ tcb.overrideView(MainComp, new ViewMetadata({
template: '' +
'A
' +
'B
' +
@@ -202,7 +203,7 @@ export function main() {
it("should support nesting with content being direct child of a nested component",
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
- tcb.overrideView(MainComp, new View({
+ tcb.overrideView(MainComp, new ViewMetadata({
template: '' +
'A
' +
'B
' +
@@ -226,7 +227,7 @@ export function main() {
it('should redistribute when the shadow dom changes',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
- tcb.overrideView(MainComp, new View({
+ tcb.overrideView(MainComp, new ViewMetadata({
template: '' +
'A
' +
'B
' +
@@ -260,7 +261,8 @@ export function main() {
tcb.overrideView(
MainComp,
- new View({template: '', directives: [Simple]}))
+ new ViewMetadata(
+ {template: '', directives: [Simple]}))
.overrideTemplate(Simple, 'P,
{{stringProp}}')
.createAsync(MainComp)
.then((main) => {
@@ -280,7 +282,8 @@ export function main() {
tcb.overrideView(
MainComp,
- new View({template: '', directives: [Simple]}))
+ new ViewMetadata(
+ {template: '', directives: [Simple]}))
.overrideTemplate(Simple, 'P,
{{stringProp}}')
.createAsync(MainComp)
.then((main) => {
@@ -293,7 +296,7 @@ export function main() {
it('should support moving non projected light dom around',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
- tcb.overrideView(MainComp, new View({
+ tcb.overrideView(MainComp, new ViewMetadata({
template: '' +
' A
' +
'' +
@@ -318,7 +321,7 @@ export function main() {
it('should support moving projected light dom around',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
- tcb.overrideView(MainComp, new View({
+ tcb.overrideView(MainComp, new ViewMetadata({
template: 'A
' +
'START()END',
directives: [Simple, ProjectDirective, ManualViewportDirective],
@@ -342,7 +345,7 @@ export function main() {
it('should support moving ng-content around',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideView(
- MainComp, new View({
+ MainComp, new ViewMetadata({
template: '' +
'A
' +
'B
' +
@@ -378,7 +381,8 @@ export function main() {
// the presence of ng-content elements!
it('should still allow to implement a recursive trees',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
- tcb.overrideView(MainComp, new View({template: '', directives: [Tree]}))
+ tcb.overrideView(MainComp,
+ new ViewMetadata({template: '', directives: [Tree]}))
.createAsync(MainComp)
.then((main) => {
@@ -397,7 +401,7 @@ export function main() {
if (DOM.supportsNativeShadowDOM()) {
it('should support native content projection',
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
- tcb.overrideView(MainComp, new View({
+ tcb.overrideView(MainComp, new ViewMetadata({
template: '' +
'A
' +
'',
@@ -417,7 +421,7 @@ export function main() {
it('should support nested conditionals that contain ng-contents',
inject(
[TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
- tcb.overrideView(MainComp, new View({
+ tcb.overrideView(MainComp, new ViewMetadata({
template: `a`,
directives: [ConditionalTextComponent]
}))
diff --git a/modules/angular2/test/core/directive_lifecycle_integration_spec.ts b/modules/angular2/test/core/directive_lifecycle_integration_spec.ts
index f8056a5b64..c7dd775af6 100644
--- a/modules/angular2/test/core/directive_lifecycle_integration_spec.ts
+++ b/modules/angular2/test/core/directive_lifecycle_integration_spec.ts
@@ -12,7 +12,7 @@ import {
TestComponentBuilder
} from 'angular2/test_lib';
-import {Directive, Component, View, LifecycleEvent} from 'angular2/angular2';
+import {Directive, Component, View, ViewMetadata, LifecycleEvent} from 'angular2/metadata';
export function main() {
describe('directive lifecycle integration spec', () => {
@@ -21,7 +21,7 @@ export function main() {
inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => {
tcb.overrideView(
MyComp,
- new View(
+ new ViewMetadata(
{template: '', directives: [LifecycleDir]}))
.createAsync(MyComp)
.then((tc) => {
diff --git a/modules/angular2/test/mock/view_resolver_mock_spec.ts b/modules/angular2/test/mock/view_resolver_mock_spec.ts
index b13a7e9e8d..5301806848 100644
--- a/modules/angular2/test/mock/view_resolver_mock_spec.ts
+++ b/modules/angular2/test/mock/view_resolver_mock_spec.ts
@@ -12,7 +12,7 @@ import {stringify} from 'angular2/src/facade/lang';
import {MockViewResolver} from 'angular2/src/mock/view_resolver_mock';
-import {Component, View} from 'angular2/angular2';
+import {Component, View, ViewMetadata} from 'angular2/metadata';
import {isBlank} from 'angular2/src/facade/lang';
@@ -30,7 +30,7 @@ export function main() {
});
it('should allow overriding the @View', () => {
- viewResolver.setView(SomeComponent, new View({template: 'overridden template'}));
+ viewResolver.setView(SomeComponent, new ViewMetadata({template: 'overridden template'}));
var view = viewResolver.resolve(SomeComponent);
expect(view.template).toEqual('overridden template');
expect(isBlank(view.directives)).toBe(true);
@@ -40,7 +40,7 @@ export function main() {
it('should not allow overriding a view after it has been resolved', () => {
viewResolver.resolve(SomeComponent);
expect(() => {
- viewResolver.setView(SomeComponent, new View({template: 'overridden template'}));
+ viewResolver.setView(SomeComponent, new ViewMetadata({template: 'overridden template'}));
})
.toThrowError(
`The component ${stringify(SomeComponent)} has already been compiled, its configuration can not be changed`);
@@ -56,7 +56,7 @@ export function main() {
});
it('should allow overriding an overriden @View', () => {
- viewResolver.setView(SomeComponent, new View({template: 'overridden template'}));
+ viewResolver.setView(SomeComponent, new ViewMetadata({template: 'overridden template'}));
viewResolver.setInlineTemplate(SomeComponent, 'overridden template x 2');
var view = viewResolver.resolve(SomeComponent);
expect(view.template).toEqual('overridden template x 2');
@@ -80,7 +80,7 @@ export function main() {
});
it('should allow overriding a directive from an overriden @View', () => {
- viewResolver.setView(SomeComponent, new View({directives: [SomeOtherDirective]}));
+ viewResolver.setView(SomeComponent, new ViewMetadata({directives: [SomeOtherDirective]}));
viewResolver.overrideViewDirective(SomeComponent, SomeOtherDirective, SomeComponent);
var view = viewResolver.resolve(SomeComponent);
expect(view.directives.length).toEqual(1);
diff --git a/modules/angular2/test/router/outlet_spec.ts b/modules/angular2/test/router/outlet_spec.ts
index f5cade14ea..a47605b30d 100644
--- a/modules/angular2/test/router/outlet_spec.ts
+++ b/modules/angular2/test/router/outlet_spec.ts
@@ -16,7 +16,7 @@ import {
} from 'angular2/test_lib';
import {Injector, Inject, bind} from 'angular2/di';
-import {Component, View} from 'angular2/metadata';
+import {Component, View, ViewMetadata} from 'angular2/metadata';
import {CONST, NumberWrapper, isPresent, Json} from 'angular2/src/facade/lang';
import {
Promise,
@@ -85,7 +85,7 @@ export function main() {
}));
function compile(template: string = "") {
- return tcb.overrideView(MyComp, new View({
+ return tcb.overrideView(MyComp, new ViewMetadata({
template: ('' + template + '
'),
directives: [RouterOutlet, RouterLink]
}))
diff --git a/modules/benchmarks/src/compiler/compiler_benchmark.ts b/modules/benchmarks/src/compiler/compiler_benchmark.ts
index f69bfc6109..8696325864 100644
--- a/modules/benchmarks/src/compiler/compiler_benchmark.ts
+++ b/modules/benchmarks/src/compiler/compiler_benchmark.ts
@@ -13,7 +13,7 @@ import {Compiler, CompilerCache} from 'angular2/src/core/compiler/compiler';
import {DirectiveResolver} from 'angular2/src/core/compiler/directive_resolver';
import {PipeResolver} from 'angular2/src/core/compiler/pipe_resolver';
-import {Component, Directive, View} from 'angular2/angular2';
+import {Component, Directive, View, ViewMetadata} from 'angular2/metadata';
import {ViewResolver} from 'angular2/src/core/compiler/view_resolver';
import {UrlResolver} from 'angular2/src/services/url_resolver';
import {AppRootUrl} from 'angular2/src/services/app_root_url';
@@ -121,11 +121,10 @@ class MultipleViewResolver extends ViewResolver {
this._cache.set(component, ListWrapper.join(multiplier, ''));
}
- resolve(component: Type): View {
+ resolve(component: Type): ViewMetadata {
var view = super.resolve(component);
- var myView =
- new View({template:this._cache.get(component), directives: view.directives});
- return myView;
+ return new ViewMetadata(
+ {template:this._cache.get(component), directives: view.directives});
}
}