11import  { 
2-  Injector ,  Injectable ,  provide , 
2+  ReflectiveInjector ,  Injectable ,  provide , 
33 Component ,  Directive , 
44 QueryList , 
55 AttributeMetadata ,  QueryMetadata ,  ViewQueryMetadata , 
@@ -10,20 +10,23 @@ import {
1010 NgFor 
1111}  from  'angular2/common' ; 
1212import  { 
13-  AsyncTestCompleter , 
1413 beforeEach , 
1514 describe , 
1615 expect , 
1716 inject , 
1817 it , 
1918 xit , 
19+  async , 
2020 TestComponentBuilder , 
21- }  from  'angular2/testing_internal ' ; 
21+ }  from  'angular2/testing ' ; 
2222
2323describe ( 'parameter decorator alternatives' ,  ( )  =>  { 
2424 describe ( 'Directive DI' ,  ( )  =>  { 
25-  it ( 'works as @Attribute' ,  inject ( [ TestComponentBuilder ,  AsyncTestCompleter ] ,  ( tcb ,  async )  =>  { 
26-  @Directive ( {  selector : 'foo'  } ) 
25+  it ( 'works as @Attribute' ,  async ( inject ( [ TestComponentBuilder ] ,  ( tcb )  =>  { 
26+  @Component ( { 
27+  selector : 'foo' , 
28+  template : '{{bar}}' 
29+  } ) 
2730 @Reflect . metadata ( 'parameters' ,  [ [ new  AttributeMetadata ( 'bar' ) ] ] ) 
2831 class  Foo  { 
2932 constructor ( barProp )  { 
@@ -42,12 +45,10 @@ describe('parameter decorator alternatives', () => {
4245 . then ( ( fixture )  =>  { 
4346 const  foo  =  fixture . debugElement . children [ 0 ] . componentInstance ; 
4447 expect ( foo . bar ) . toEqual ( 'baz' ) ; 
45- 
46-  async . done ( ) ; 
4748 } ) ; 
48-  } ) ) ; 
49+  } ) ) ) ; 
4950
50-  it ( 'works as @Query' ,  inject ( [ TestComponentBuilder ,   AsyncTestCompleter ] ,  ( tcb ,   async )  =>  { 
51+  it ( 'works as @Query' ,  async ( inject ( [ TestComponentBuilder ] ,  ( tcb )  =>  { 
5152 @Component ( { 
5253 selector : 'pane' , 
5354 inputs : [ 'title' ] , 
@@ -62,7 +63,7 @@ describe('parameter decorator alternatives', () => {
6263 directives : [ NgFor ] , 
6364 template : ` 
6465 <ul> 
65-  <li *ngFor="# pane of panes">{{pane.title}}</li> 
66+  <li *ngFor="let  pane of panes">{{pane.title}}</li> 
6667 </ul> 
6768 <ng-content></ng-content> 
6869 ` 
@@ -80,7 +81,7 @@ describe('parameter decorator alternatives', () => {
8081 template : ` 
8182 <tabs> 
8283 <pane title="Overview">...</pane> 
83-  <pane *ngFor="# o of objects" [title]="o.title">{{o.text}}</pane> 
84+  <pane *ngFor="let  o of objects" [title]="o.title">{{o.text}}</pane> 
8485 </tabs> 
8586 ` 
8687 } ) 
@@ -101,12 +102,10 @@ describe('parameter decorator alternatives', () => {
101102 expect ( [ ...listItems ] . map ( ( l )  =>  l . textContent ) ) . toEqual ( [ 'Overview' ,  'foo' ,  'bar' ,  'baz' ] ) ; 
102103 const  panes  =  tabs . nativeElement . querySelectorAll ( 'div' ) ; 
103104 expect ( [ ...panes ] . map ( ( p )  =>  p . textContent ) ) . toEqual ( [ '...' ,  'Foo!' ,  'Bar!' ,  'Baz!' ] ) ; 
104- 
105-  async . done ( ) ; 
106105 } ) ; 
107-  } ) ) ; 
106+  } ) ) ) ; 
108107
109-  it ( 'works as @ViewQuery' ,  inject ( [ TestComponentBuilder ,   AsyncTestCompleter ] ,  ( tcb ,   async )  =>  { 
108+  it ( 'works as @ViewQuery' ,  async ( inject ( [ TestComponentBuilder ] ,  ( tcb )  =>  { 
110109 @Component ( { 
111110 selector : 'item' , 
112111 template : '<ng-content></ng-content>' 
@@ -134,19 +133,20 @@ describe('parameter decorator alternatives', () => {
134133 const  items  =  fixture . componentInstance . items ; 
135134 items . changes . subscribe ( ( )  =>  { 
136135 expect ( items . length ) . toEqual ( 3 ) ; 
137- 
138-  async . done ( ) ; 
139136 } ) ; 
140137
141138 fixture . detectChanges ( ) ; 
142139 } ) ; 
143-  } ) ) ; 
140+  } ) ) ) ; 
144141
145-  it ( 'works as @Host' ,  inject ( [ TestComponentBuilder ,   AsyncTestCompleter ] ,  ( tcb ,   async )  =>  { 
142+  it ( 'works as @Host' ,  async ( inject ( [ TestComponentBuilder ] ,  ( tcb )  =>  { 
146143 class  OtherService  { } 
147144 class  HostService  { } 
148145
149-  @Directive ( {  selector : 'child-directive'  } ) 
146+  @Component ( { 
147+  selector : 'child-directive' , 
148+  template : 'child' 
149+  } ) 
150150 @Reflect . metadata ( 'parameters' ,  [ 
151151 [ new  OptionalMetadata ( ) ,  new  HostMetadata ( ) ] , 
152152 [ new  OptionalMetadata ( ) ,  new  HostMetadata ( ) ] 
@@ -183,12 +183,9 @@ describe('parameter decorator alternatives', () => {
183183 const  parent  =  fixture . debugElement . children [ 0 ] ; 
184184 const  childInstance  =  parent . children [ 0 ] . componentInstance ; 
185185 expect ( childInstance . os ) . toBeNull ( ) ; 
186-  expect ( childInstance . hs ) . toBeAnInstanceOf ( HostService ) 
187- 
188-  async . done ( ) ; 
189-  } ) 
190-  . catch ( ( e )  =>  console . error ( e ) ) ; 
191-  } ) ) ; 
186+  expect ( childInstance . hs ) . toBeAnInstanceOf ( HostService ) ; 
187+  } ) ; 
188+  } ) ) ) ; 
192189 } ) ; 
193190
194191 describe ( 'Pure DI' ,  ( )  =>  { 
@@ -203,7 +200,7 @@ describe('parameter decorator alternatives', () => {
203200 } 
204201 } 
205202
206-  const  injector  =  Injector . resolveAndCreate ( [ 
203+  const  injector  =  ReflectiveInjector . resolveAndCreate ( [ 
207204 provide ( 'MyEngine' ,  {  useClass : Engine  } ) , 
208205 Car 
209206 ] ) ; 
@@ -222,7 +219,7 @@ describe('parameter decorator alternatives', () => {
222219 } 
223220 } 
224221
225-  const  injector  =  Injector . resolveAndCreate ( [ Car ] ) ; 
222+  const  injector  =  ReflectiveInjector . resolveAndCreate ( [ Car ] ) ; 
226223
227224 expect ( injector . get ( Car ) . engine ) . toBeNull ( ) ; 
228225 } ) ) ; 
@@ -238,10 +235,10 @@ describe('parameter decorator alternatives', () => {
238235 } 
239236 } 
240237
241-  const  injector  =  Injector . resolveAndCreate ( [ Dependency ,  NeedsDependency ] ) ; 
238+  const  injector  =  ReflectiveInjector . resolveAndCreate ( [ Dependency ,  NeedsDependency ] ) ; 
242239 expect ( injector . get ( NeedsDependency ) . dependency ) . toBeAnInstanceOf ( Dependency ) ; 
243240
244-  const  parent =  Injector . resolveAndCreate ( [ Dependency ] ) ; 
241+  const  parent =  ReflectiveInjector . resolveAndCreate ( [ Dependency ] ) ; 
245242 const  child =  parent . resolveAndCreateChild ( [ NeedsDependency ] ) ; 
246243 expect ( ( )  =>  child . get ( NeedsDependency ) ) . toThrowError ( ) ; 
247244 } ) ) ; 
@@ -257,10 +254,10 @@ describe('parameter decorator alternatives', () => {
257254 } 
258255 } 
259256
260-  const  injector  =  Injector . resolveAndCreate ( [ Dependency ,  NeedsDependency ] ) ; 
257+  const  injector  =  ReflectiveInjector . resolveAndCreate ( [ Dependency ,  NeedsDependency ] ) ; 
261258 expect ( ( )  =>  injector . get ( NeedsDependency ) ) . toThrowError ( ) ; 
262259
263-  const  parent =  Injector . resolveAndCreate ( [ Dependency ] ) ; 
260+  const  parent =  ReflectiveInjector . resolveAndCreate ( [ Dependency ] ) ; 
264261 const  child =  parent . resolveAndCreateChild ( [ NeedsDependency ] ) ; 
265262 expect ( child . get ( NeedsDependency ) . dependency ) . toBeAnInstanceOf ( Dependency ) ; 
266263 } ) ) ; 
0 commit comments