| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  | import { | 
					
						
							|  |  |  |   AsyncTestCompleter, | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |   TestComponentBuilder, | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  |   beforeEach, | 
					
						
							|  |  |  |   beforeEachBindings, | 
					
						
							|  |  |  |   ddescribe, | 
					
						
							|  |  |  |   describe, | 
					
						
							|  |  |  |   el, | 
					
						
							|  |  |  |   expect, | 
					
						
							|  |  |  |   iit, | 
					
						
							|  |  |  |   inject, | 
					
						
							|  |  |  |   it, | 
					
						
							|  |  |  |   xit, | 
					
						
							|  |  |  | } from 'angular2/test_lib'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import {ListWrapper} from 'angular2/src/facade/collection'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import {Component, View} from 'angular2/angular2'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import {NgFor} from 'angular2/src/directives/ng_for'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export function main() { | 
					
						
							|  |  |  |   describe('ng-for', () => { | 
					
						
							|  |  |  |     var TEMPLATE = | 
					
						
							|  |  |  |         '<div><copy-me template="ng-for #item of items">{{item.toString()}};</copy-me></div>'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-11 18:50:41 -07:00
										 |  |  |     it('should reflect initial elements', | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |        inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => { | 
					
						
							|  |  |  |          tcb.overrideTemplate(TestComponent, TEMPLATE) | 
					
						
							|  |  |  |              .createAsync(TestComponent) | 
					
						
							|  |  |  |              .then((rootTC) => { | 
					
						
							|  |  |  |                rootTC.detectChanges(); | 
					
						
							|  |  |  |                expect(rootTC.nativeElement).toHaveText('1;2;'); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  |                async.done(); | 
					
						
							|  |  |  |              }); | 
					
						
							|  |  |  |        })); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-11 18:50:41 -07:00
										 |  |  |     it('should reflect added elements', | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |        inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => { | 
					
						
							|  |  |  |          tcb.overrideTemplate(TestComponent, TEMPLATE) | 
					
						
							|  |  |  |              .createAsync(TestComponent) | 
					
						
							|  |  |  |              .then((rootTC) => { | 
					
						
							|  |  |  |                rootTC.detectChanges(); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |                (<number[]>rootTC.componentInstance.items).push(3); | 
					
						
							|  |  |  |                rootTC.detectChanges(); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |                expect(rootTC.nativeElement).toHaveText('1;2;3;'); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  |                async.done(); | 
					
						
							|  |  |  |              }); | 
					
						
							|  |  |  |        })); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-11 18:50:41 -07:00
										 |  |  |     it('should reflect removed elements', | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |        inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => { | 
					
						
							|  |  |  |          tcb.overrideTemplate(TestComponent, TEMPLATE) | 
					
						
							|  |  |  |              .createAsync(TestComponent) | 
					
						
							|  |  |  |              .then((rootTC) => { | 
					
						
							|  |  |  |                rootTC.detectChanges(); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |                ListWrapper.removeAt(rootTC.componentInstance.items, 1); | 
					
						
							|  |  |  |                rootTC.detectChanges(); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |                expect(rootTC.nativeElement).toHaveText('1;'); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  |                async.done(); | 
					
						
							|  |  |  |              }); | 
					
						
							|  |  |  |        })); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-11 18:50:41 -07:00
										 |  |  |     it('should reflect moved elements', | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |        inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => { | 
					
						
							|  |  |  |          tcb.overrideTemplate(TestComponent, TEMPLATE) | 
					
						
							|  |  |  |              .createAsync(TestComponent) | 
					
						
							|  |  |  |              .then((rootTC) => { | 
					
						
							|  |  |  |                rootTC.detectChanges(); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |                ListWrapper.removeAt(rootTC.componentInstance.items, 0); | 
					
						
							|  |  |  |                (<number[]>rootTC.componentInstance.items).push(1); | 
					
						
							|  |  |  |                rootTC.detectChanges(); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |                expect(rootTC.nativeElement).toHaveText('2;1;'); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  |                async.done(); | 
					
						
							|  |  |  |              }); | 
					
						
							|  |  |  |        })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('should reflect a mix of all changes (additions/removals/moves)', | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |        inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => { | 
					
						
							|  |  |  |          tcb.overrideTemplate(TestComponent, TEMPLATE) | 
					
						
							|  |  |  |              .createAsync(TestComponent) | 
					
						
							|  |  |  |              .then((rootTC) => { | 
					
						
							|  |  |  |                rootTC.componentInstance.items = [0, 1, 2, 3, 4, 5]; | 
					
						
							|  |  |  |                rootTC.detectChanges(); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |                rootTC.componentInstance.items = [6, 2, 7, 0, 4, 8]; | 
					
						
							|  |  |  |                rootTC.detectChanges(); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |                expect(rootTC.nativeElement).toHaveText('6;2;7;0;4;8;'); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  |                async.done(); | 
					
						
							|  |  |  |              }); | 
					
						
							|  |  |  |        })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('should iterate over an array of objects', | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |        inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => { | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  |          var template = '<ul><li template="ng-for #item of items">{{item["name"]}};</li></ul>'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |          tcb.overrideTemplate(TestComponent, template) | 
					
						
							|  |  |  |              .createAsync(TestComponent) | 
					
						
							|  |  |  |              .then((rootTC) => { | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |                // INIT
 | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |                rootTC.componentInstance.items = [{'name': 'misko'}, {'name': 'shyam'}]; | 
					
						
							|  |  |  |                rootTC.detectChanges(); | 
					
						
							|  |  |  |                expect(rootTC.nativeElement).toHaveText('misko;shyam;'); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |                // GROW
 | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |                (<any[]>rootTC.componentInstance.items).push({'name': 'adam'}); | 
					
						
							|  |  |  |                rootTC.detectChanges(); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |                expect(rootTC.nativeElement).toHaveText('misko;shyam;adam;'); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |                // SHRINK
 | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |                ListWrapper.removeAt(rootTC.componentInstance.items, 2); | 
					
						
							|  |  |  |                ListWrapper.removeAt(rootTC.componentInstance.items, 0); | 
					
						
							|  |  |  |                rootTC.detectChanges(); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |                expect(rootTC.nativeElement).toHaveText('shyam;'); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  |                async.done(); | 
					
						
							|  |  |  |              }); | 
					
						
							|  |  |  |        })); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-11 18:50:41 -07:00
										 |  |  |     it('should gracefully handle nulls', | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |        inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => { | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  |          var template = '<ul><li template="ng-for #item of null">{{item}};</li></ul>'; | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |          tcb.overrideTemplate(TestComponent, template) | 
					
						
							|  |  |  |              .createAsync(TestComponent) | 
					
						
							|  |  |  |              .then((rootTC) => { | 
					
						
							|  |  |  |                rootTC.detectChanges(); | 
					
						
							|  |  |  |                expect(rootTC.nativeElement).toHaveText(''); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  |                async.done(); | 
					
						
							|  |  |  |              }); | 
					
						
							|  |  |  |        })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('should gracefully handle ref changing to null and back', | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |        inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => { | 
					
						
							|  |  |  |          tcb.overrideTemplate(TestComponent, TEMPLATE) | 
					
						
							|  |  |  |              .createAsync(TestComponent) | 
					
						
							|  |  |  |              .then((rootTC) => { | 
					
						
							|  |  |  |                rootTC.detectChanges(); | 
					
						
							|  |  |  |                expect(rootTC.nativeElement).toHaveText('1;2;'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                rootTC.componentInstance.items = null; | 
					
						
							|  |  |  |                rootTC.detectChanges(); | 
					
						
							|  |  |  |                expect(rootTC.nativeElement).toHaveText(''); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                rootTC.componentInstance.items = [1, 2, 3]; | 
					
						
							|  |  |  |                rootTC.detectChanges(); | 
					
						
							|  |  |  |                expect(rootTC.nativeElement).toHaveText('1;2;3;'); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  |                async.done(); | 
					
						
							|  |  |  |              }); | 
					
						
							|  |  |  |        })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('should throw on ref changing to string', | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |        inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => { | 
					
						
							|  |  |  |          tcb.overrideTemplate(TestComponent, TEMPLATE) | 
					
						
							|  |  |  |              .createAsync(TestComponent) | 
					
						
							|  |  |  |              .then((rootTC) => { | 
					
						
							|  |  |  |                rootTC.detectChanges(); | 
					
						
							|  |  |  |                expect(rootTC.nativeElement).toHaveText('1;2;'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                rootTC.componentInstance.items = 'whaaa'; | 
					
						
							|  |  |  |                expect(() => rootTC.detectChanges()).toThrowError(); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  |                async.done(); | 
					
						
							|  |  |  |              }); | 
					
						
							|  |  |  |        })); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-11 18:50:41 -07:00
										 |  |  |     it('should works with duplicates', | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |        inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => { | 
					
						
							|  |  |  |          tcb.overrideTemplate(TestComponent, TEMPLATE) | 
					
						
							|  |  |  |              .createAsync(TestComponent) | 
					
						
							|  |  |  |              .then((rootTC) => { | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  |                var a = new Foo(); | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |                rootTC.componentInstance.items = [a, a]; | 
					
						
							|  |  |  |                rootTC.detectChanges(); | 
					
						
							|  |  |  |                expect(rootTC.nativeElement).toHaveText('foo;foo;'); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  |                async.done(); | 
					
						
							|  |  |  |              }); | 
					
						
							|  |  |  |        })); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-11 18:50:41 -07:00
										 |  |  |     it('should repeat over nested arrays', | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |        inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => { | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  |          var template = '<div>' + | 
					
						
							|  |  |  |                         '<div template="ng-for #item of items">' + | 
					
						
							|  |  |  |                         '<div template="ng-for #subitem of item">' + | 
					
						
							|  |  |  |                         '{{subitem}}-{{item.length}};' + | 
					
						
							|  |  |  |                         '</div>|' + | 
					
						
							|  |  |  |                         '</div>' + | 
					
						
							|  |  |  |                         '</div>'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |          tcb.overrideTemplate(TestComponent, template) | 
					
						
							|  |  |  |              .createAsync(TestComponent) | 
					
						
							|  |  |  |              .then((rootTC) => { | 
					
						
							|  |  |  |                rootTC.componentInstance.items = [['a', 'b'], ['c']]; | 
					
						
							|  |  |  |                rootTC.detectChanges(); | 
					
						
							|  |  |  |                rootTC.detectChanges(); | 
					
						
							|  |  |  |                rootTC.detectChanges(); | 
					
						
							|  |  |  |                expect(rootTC.nativeElement).toHaveText('a-2;b-2;|c-1;|'); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |                rootTC.componentInstance.items = [['e'], ['f', 'g']]; | 
					
						
							|  |  |  |                rootTC.detectChanges(); | 
					
						
							|  |  |  |                expect(rootTC.nativeElement).toHaveText('e-1;|f-2;g-2;|'); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |                async.done(); | 
					
						
							|  |  |  |              }); | 
					
						
							|  |  |  |        })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('should repeat over nested arrays with no intermediate element', | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |        inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => { | 
					
						
							| 
									
										
										
										
											2015-06-17 16:05:35 +02:00
										 |  |  |          var template = '<div><template ng-for #item [ng-for-of]="items">' + | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  |                         '<div template="ng-for #subitem of item">' + | 
					
						
							|  |  |  |                         '{{subitem}}-{{item.length}};' + | 
					
						
							|  |  |  |                         '</div></template></div>'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |          tcb.overrideTemplate(TestComponent, template) | 
					
						
							|  |  |  |              .createAsync(TestComponent) | 
					
						
							|  |  |  |              .then((rootTC) => { | 
					
						
							|  |  |  |                rootTC.componentInstance.items = [['a', 'b'], ['c']]; | 
					
						
							|  |  |  |                rootTC.detectChanges(); | 
					
						
							|  |  |  |                expect(rootTC.nativeElement).toHaveText('a-2;b-2;c-1;'); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |                rootTC.componentInstance.items = [['e'], ['f', 'g']]; | 
					
						
							|  |  |  |                rootTC.detectChanges(); | 
					
						
							|  |  |  |                expect(rootTC.nativeElement).toHaveText('e-1;f-2;g-2;'); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  |                async.done(); | 
					
						
							|  |  |  |              }); | 
					
						
							|  |  |  |        })); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-11 18:50:41 -07:00
										 |  |  |     it('should display indices correctly', | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |        inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => { | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  |          var template = | 
					
						
							|  |  |  |              '<div><copy-me template="ng-for: var item of items; var i=index">{{i.toString()}}</copy-me></div>'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |          tcb.overrideTemplate(TestComponent, template) | 
					
						
							|  |  |  |              .createAsync(TestComponent) | 
					
						
							|  |  |  |              .then((rootTC) => { | 
					
						
							|  |  |  |                rootTC.componentInstance.items = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; | 
					
						
							|  |  |  |                rootTC.detectChanges(); | 
					
						
							|  |  |  |                expect(rootTC.nativeElement).toHaveText('0123456789'); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  |                rootTC.componentInstance.items = [1, 2, 6, 7, 4, 3, 5, 8, 9, 0]; | 
					
						
							|  |  |  |                rootTC.detectChanges(); | 
					
						
							|  |  |  |                expect(rootTC.nativeElement).toHaveText('0123456789'); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  |                async.done(); | 
					
						
							|  |  |  |              }); | 
					
						
							|  |  |  |        })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class Foo { | 
					
						
							|  |  |  |   toString() { return 'foo'; } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @Component({selector: 'test-cmp'}) | 
					
						
							|  |  |  | @View({directives: [NgFor]}) | 
					
						
							|  |  |  | class TestComponent { | 
					
						
							|  |  |  |   items: any; | 
					
						
							|  |  |  |   constructor() { this.items = [1, 2]; } | 
					
						
							|  |  |  | } |