@@ -24,24 +24,22 @@ import {
2424import { DOM } from 'angular2/src/dom/dom_adapter' ;
2525
2626import {
27- Component ,
28- Directive ,
29- View ,
3027 forwardRef ,
3128 ViewContainerRef ,
3229 ElementRef ,
3330 TemplateRef ,
3431 bind ,
3532 ViewEncapsulation
3633} from 'angular2/angular2' ;
34+ import { Component , Directive , View , ViewMetadata } from 'angular2/metadata' ;
3735
3836import { MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE } from 'angular2/src/render/render' ;
3937
4038export function main ( ) {
4139 describe ( 'projection' , ( ) => {
4240 it ( 'should support simple components' ,
4341 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
44- tcb . overrideView ( MainComp , new View ( {
42+ tcb . overrideView ( MainComp , new ViewMetadata ( {
4543 template : '<simple>' +
4644 '<div>A</div>' +
4745 '</simple>' ,
@@ -56,7 +54,7 @@ export function main() {
5654
5755 it ( 'should support simple components with text interpolation as direct children' ,
5856 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
59- tcb . overrideView ( MainComp , new View ( {
57+ tcb . overrideView ( MainComp , new ViewMetadata ( {
6058 template : '{{\'START(\'}}<simple>' +
6159 '{{text}}' +
6260 '</simple>{{\')END\'}}' ,
@@ -76,10 +74,11 @@ export function main() {
7674 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
7775 tcb . overrideView (
7876 Simple ,
79- new View (
77+ new ViewMetadata (
8078 { template : 'SIMPLE(<div><ng-content></ng-content></div>)' , directives : [ ] } ) )
81- . overrideView ( MainComp ,
82- new View ( { template : '<simple>{{text}}</simple>' , directives : [ Simple ] } ) )
79+ . overrideView (
80+ MainComp ,
81+ new ViewMetadata ( { template : '<simple>{{text}}</simple>' , directives : [ Simple ] } ) )
8382 . createAsync ( MainComp )
8483 . then ( ( main ) => {
8584
@@ -94,13 +93,14 @@ export function main() {
9493 it ( 'should support projecting text interpolation to a non bound element with other bound elements after it' ,
9594 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
9695 tcb . overrideView (
97- Simple , new View ( {
96+ Simple , new ViewMetadata ( {
9897 template :
9998 'SIMPLE(<div><ng-content></ng-content></div><div [tab-index]="0">EL</div>)' ,
10099 directives : [ ]
101100 } ) )
102- . overrideView ( MainComp ,
103- new View ( { template : '<simple>{{text}}</simple>' , directives : [ Simple ] } ) )
101+ . overrideView (
102+ MainComp ,
103+ new ViewMetadata ( { template : '<simple>{{text}}</simple>' , directives : [ Simple ] } ) )
104104 . createAsync ( MainComp )
105105 . then ( ( main ) => {
106106
@@ -113,7 +113,8 @@ export function main() {
113113
114114 it ( 'should not show the light dom even if there is no content tag' ,
115115 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
116- tcb . overrideView ( MainComp , new View ( { template : '<empty>A</empty>' , directives : [ Empty ] } ) )
116+ tcb . overrideView ( MainComp ,
117+ new ViewMetadata ( { template : '<empty>A</empty>' , directives : [ Empty ] } ) )
117118 . createAsync ( MainComp )
118119 . then ( ( main ) => {
119120
@@ -124,7 +125,7 @@ export function main() {
124125
125126 it ( 'should support multiple content tags' ,
126127 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
127- tcb . overrideView ( MainComp , new View ( {
128+ tcb . overrideView ( MainComp , new ViewMetadata ( {
128129 template : '<multiple-content-tags>' +
129130 '<div>B</div>' +
130131 '<div>C</div>' +
@@ -142,7 +143,7 @@ export function main() {
142143
143144 it ( 'should redistribute only direct children' ,
144145 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
145- tcb . overrideView ( MainComp , new View ( {
146+ tcb . overrideView ( MainComp , new ViewMetadata ( {
146147 template : '<multiple-content-tags>' +
147148 '<div>B<div class="left">A</div></div>' +
148149 '<div>C</div>' +
@@ -159,7 +160,7 @@ export function main() {
159160
160161 it ( "should redistribute direct child viewcontainers when the light dom changes" ,
161162 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
162- tcb . overrideView ( MainComp , new View ( {
163+ tcb . overrideView ( MainComp , new ViewMetadata ( {
163164 template : '<multiple-content-tags>' +
164165 '<template manual class="left"><div>A1</div></template>' +
165166 '<div>B</div>' +
@@ -185,7 +186,7 @@ export function main() {
185186
186187 it ( "should support nested components" ,
187188 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
188- tcb . overrideView ( MainComp , new View ( {
189+ tcb . overrideView ( MainComp , new ViewMetadata ( {
189190 template : '<outer-with-indirect-nested>' +
190191 '<div>A</div>' +
191192 '<div>B</div>' +
@@ -202,7 +203,7 @@ export function main() {
202203
203204 it ( "should support nesting with content being direct child of a nested component" ,
204205 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
205- tcb . overrideView ( MainComp , new View ( {
206+ tcb . overrideView ( MainComp , new ViewMetadata ( {
206207 template : '<outer>' +
207208 '<template manual class="left"><div>A</div></template>' +
208209 '<div>B</div>' +
@@ -226,7 +227,7 @@ export function main() {
226227
227228 it ( 'should redistribute when the shadow dom changes' ,
228229 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
229- tcb . overrideView ( MainComp , new View ( {
230+ tcb . overrideView ( MainComp , new ViewMetadata ( {
230231 template : '<conditional-content>' +
231232 '<div class="left">A</div>' +
232233 '<div>B</div>' +
@@ -260,7 +261,8 @@ export function main() {
260261
261262 tcb . overrideView (
262263 MainComp ,
263- new View ( { template : '<simple string-prop="text"></simple>' , directives : [ Simple ] } ) )
264+ new ViewMetadata (
265+ { template : '<simple string-prop="text"></simple>' , directives : [ Simple ] } ) )
264266 . overrideTemplate ( Simple , '<ng-content></ng-content><p>P,</p>{{stringProp}}' )
265267 . createAsync ( MainComp )
266268 . then ( ( main ) => {
@@ -280,7 +282,8 @@ export function main() {
280282
281283 tcb . overrideView (
282284 MainComp ,
283- new View ( { template : '<simple string-prop="text"></simple>' , directives : [ Simple ] } ) )
285+ new ViewMetadata (
286+ { template : '<simple string-prop="text"></simple>' , directives : [ Simple ] } ) )
284287 . overrideTemplate ( Simple , '<style></style><p>P,</p>{{stringProp}}' )
285288 . createAsync ( MainComp )
286289 . then ( ( main ) => {
@@ -293,7 +296,7 @@ export function main() {
293296
294297 it ( 'should support moving non projected light dom around' ,
295298 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
296- tcb . overrideView ( MainComp , new View ( {
299+ tcb . overrideView ( MainComp , new ViewMetadata ( {
297300 template : '<empty>' +
298301 ' <template manual><div>A</div></template>' +
299302 '</empty>' +
@@ -318,7 +321,7 @@ export function main() {
318321
319322 it ( 'should support moving projected light dom around' ,
320323 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
321- tcb . overrideView ( MainComp , new View ( {
324+ tcb . overrideView ( MainComp , new ViewMetadata ( {
322325 template : '<simple><template manual><div>A</div></template></simple>' +
323326 'START(<div project></div>)END' ,
324327 directives : [ Simple , ProjectDirective , ManualViewportDirective ] ,
@@ -342,7 +345,7 @@ export function main() {
342345 it ( 'should support moving ng-content around' ,
343346 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
344347 tcb . overrideView (
345- MainComp , new View ( {
348+ MainComp , new ViewMetadata ( {
346349 template : '<conditional-content>' +
347350 '<div class="left">A</div>' +
348351 '<div>B</div>' +
@@ -378,7 +381,8 @@ export function main() {
378381 // the presence of ng-content elements!
379382 it ( 'should still allow to implement a recursive trees' ,
380383 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
381- tcb . overrideView ( MainComp , new View ( { template : '<tree></tree>' , directives : [ Tree ] } ) )
384+ tcb . overrideView ( MainComp ,
385+ new ViewMetadata ( { template : '<tree></tree>' , directives : [ Tree ] } ) )
382386 . createAsync ( MainComp )
383387 . then ( ( main ) => {
384388
@@ -397,7 +401,7 @@ export function main() {
397401 if ( DOM . supportsNativeShadowDOM ( ) ) {
398402 it ( 'should support native content projection' ,
399403 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
400- tcb . overrideView ( MainComp , new View ( {
404+ tcb . overrideView ( MainComp , new ViewMetadata ( {
401405 template : '<simple-native>' +
402406 '<div>A</div>' +
403407 '</simple-native>' ,
@@ -417,7 +421,7 @@ export function main() {
417421 it ( 'should support nested conditionals that contain ng-contents' ,
418422 inject (
419423 [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
420- tcb . overrideView ( MainComp , new View ( {
424+ tcb . overrideView ( MainComp , new ViewMetadata ( {
421425 template : `<conditional-text>a</conditional-text>` ,
422426 directives : [ ConditionalTextComponent ]
423427 } ) )
0 commit comments