| 
									
										
										
										
											2015-03-13 11:10:11 +01:00
										 |  |  | import { | 
					
						
							|  |  |  |   AsyncTestCompleter, | 
					
						
							|  |  |  |   beforeEach, | 
					
						
							| 
									
										
										
										
											2015-03-13 15:30:10 +01:00
										 |  |  |   beforeEachBindings, | 
					
						
							| 
									
										
										
										
											2015-03-13 11:10:11 +01:00
										 |  |  |   ddescribe, | 
					
						
							|  |  |  |   describe, | 
					
						
							|  |  |  |   el, | 
					
						
							|  |  |  |   expect, | 
					
						
							|  |  |  |   iit, | 
					
						
							|  |  |  |   inject, | 
					
						
							|  |  |  |   it, | 
					
						
							|  |  |  |   xit, | 
					
						
							|  |  |  | } from 'angular2/test_lib'; | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-27 14:50:06 -08:00
										 |  |  | import {DOM} from 'angular2/src/dom/dom_adapter'; | 
					
						
							| 
									
										
										
										
											2015-02-24 15:32:44 +01:00
										 |  |  | import {ListWrapper} from 'angular2/src/facade/collection'; | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  | import {Component} from 'angular2/src/core/annotations/annotations'; | 
					
						
							| 
									
										
										
										
											2015-04-09 21:20:11 +02:00
										 |  |  | import {View} from 'angular2/src/core/annotations/view'; | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-13 16:22:01 -07:00
										 |  |  | import {For} from 'angular2/src/directives/for'; | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  | import {TestBed} from 'angular2/src/test_lib/test_bed'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-13 15:30:10 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | export function main() { | 
					
						
							| 
									
										
										
										
											2015-03-13 16:22:01 -07:00
										 |  |  |   describe('for', () => { | 
					
						
							|  |  |  |     var TEMPLATE = '<div><copy-me template="for #item of items">{{item.toString()}};</copy-me></div>'; | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  |     it('should reflect initial elements', inject([TestBed, AsyncTestCompleter], (tb, async) => { | 
					
						
							|  |  |  |       tb.createView(TestComponent, {html: TEMPLATE}).then((view) => { | 
					
						
							|  |  |  |         view.detectChanges(); | 
					
						
							| 
									
										
										
										
											2015-04-07 20:54:20 -07:00
										 |  |  |         expect(DOM.getText(view.rootNodes[0])).toEqual('1;2;'); | 
					
						
							| 
									
										
										
										
											2015-03-13 11:10:11 +01:00
										 |  |  |         async.done(); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  |       }); | 
					
						
							| 
									
										
										
										
											2015-03-13 11:10:11 +01:00
										 |  |  |     })); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  |     it('should reflect added elements', inject([TestBed, AsyncTestCompleter], (tb, async) => { | 
					
						
							|  |  |  |       tb.createView(TestComponent, {html: TEMPLATE}).then((view) => { | 
					
						
							|  |  |  |         view.detectChanges(); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  |         ListWrapper.push(view.context.items, 3); | 
					
						
							|  |  |  |         view.detectChanges(); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-07 20:54:20 -07:00
										 |  |  |         expect(DOM.getText(view.rootNodes[0])).toEqual('1;2;3;'); | 
					
						
							| 
									
										
										
										
											2015-03-13 11:10:11 +01:00
										 |  |  |         async.done(); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  |       }); | 
					
						
							| 
									
										
										
										
											2015-03-13 11:10:11 +01:00
										 |  |  |     })); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  |     it('should reflect removed elements', inject([TestBed, AsyncTestCompleter], (tb, async) => { | 
					
						
							|  |  |  |       tb.createView(TestComponent, {html: TEMPLATE}).then((view) => { | 
					
						
							|  |  |  |         view.detectChanges(); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  |         ListWrapper.removeAt(view.context.items, 1); | 
					
						
							|  |  |  |         view.detectChanges(); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-07 20:54:20 -07:00
										 |  |  |         expect(DOM.getText(view.rootNodes[0])).toEqual('1;'); | 
					
						
							| 
									
										
										
										
											2015-03-13 11:10:11 +01:00
										 |  |  |         async.done(); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  |       }); | 
					
						
							| 
									
										
										
										
											2015-03-13 11:10:11 +01:00
										 |  |  |     })); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  |     it('should reflect moved elements', inject([TestBed, AsyncTestCompleter], (tb, async) => { | 
					
						
							|  |  |  |       tb.createView(TestComponent, {html: TEMPLATE}).then((view) => { | 
					
						
							|  |  |  |         view.detectChanges(); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  |         ListWrapper.removeAt(view.context.items, 0); | 
					
						
							|  |  |  |         ListWrapper.push(view.context.items, 1); | 
					
						
							|  |  |  |         view.detectChanges(); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-07 20:54:20 -07:00
										 |  |  |         expect(DOM.getText(view.rootNodes[0])).toEqual('2;1;'); | 
					
						
							| 
									
										
										
										
											2015-03-13 11:10:11 +01:00
										 |  |  |         async.done(); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  |       }); | 
					
						
							| 
									
										
										
										
											2015-03-13 11:10:11 +01:00
										 |  |  |     })); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  |     it('should reflect a mix of all changes (additions/removals/moves)', | 
					
						
							|  |  |  |       inject([TestBed, AsyncTestCompleter], (tb, async) => { | 
					
						
							|  |  |  |       tb.createView(TestComponent, {html: TEMPLATE}).then((view) => { | 
					
						
							|  |  |  |         view.context.items = [0, 1, 2, 3, 4, 5]; | 
					
						
							|  |  |  |         view.detectChanges(); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  |         view.context.items = [6, 2, 7, 0, 4, 8]; | 
					
						
							|  |  |  |         view.detectChanges(); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-07 20:54:20 -07:00
										 |  |  |         expect(DOM.getText(view.rootNodes[0])).toEqual('6;2;7;0;4;8;'); | 
					
						
							| 
									
										
										
										
											2015-03-13 11:10:11 +01:00
										 |  |  |         async.done(); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  |       }); | 
					
						
							| 
									
										
										
										
											2015-03-13 11:10:11 +01:00
										 |  |  |     })); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  |     it('should iterate over an array of objects', inject([TestBed, AsyncTestCompleter], (tb, async) => { | 
					
						
							|  |  |  |       var template = '<ul><li template="for #item of items">{{item["name"]}};</li></ul>'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       tb.createView(TestComponent, {html: template}).then((view) => { | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // INIT
 | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  |         view.context.items = [{'name': 'misko'}, {'name':'shyam'}]; | 
					
						
							|  |  |  |         view.detectChanges(); | 
					
						
							| 
									
										
										
										
											2015-04-07 20:54:20 -07:00
										 |  |  |         expect(DOM.getText(view.rootNodes[0])).toEqual('misko;shyam;'); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // GROW
 | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  |         ListWrapper.push(view.context.items, {'name': 'adam'}); | 
					
						
							|  |  |  |         view.detectChanges(); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-07 20:54:20 -07:00
										 |  |  |         expect(DOM.getText(view.rootNodes[0])).toEqual('misko;shyam;adam;'); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |         // SHRINK
 | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  |         ListWrapper.removeAt(view.context.items, 2); | 
					
						
							|  |  |  |         ListWrapper.removeAt(view.context.items, 0); | 
					
						
							|  |  |  |         view.detectChanges(); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-07 20:54:20 -07:00
										 |  |  |         expect(DOM.getText(view.rootNodes[0])).toEqual('shyam;'); | 
					
						
							| 
									
										
										
										
											2015-03-13 16:22:01 -07:00
										 |  |  |         async.done(); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  |       }); | 
					
						
							| 
									
										
										
										
											2015-03-13 16:22:01 -07:00
										 |  |  |     })); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  |     it('should gracefully handle nulls', inject([TestBed, AsyncTestCompleter], (tb, async) => { | 
					
						
							|  |  |  |       var template = '<ul><li template="for #item of null">{{item}};</li></ul>'; | 
					
						
							|  |  |  |       tb.createView(TestComponent, {html: template}).then((view) => { | 
					
						
							|  |  |  |         view.detectChanges(); | 
					
						
							| 
									
										
										
										
											2015-04-07 20:54:20 -07:00
										 |  |  |         expect(DOM.getText(view.rootNodes[0])).toEqual(''); | 
					
						
							| 
									
										
										
										
											2015-03-13 11:10:11 +01:00
										 |  |  |         async.done(); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  |       }); | 
					
						
							| 
									
										
										
										
											2015-03-13 11:10:11 +01:00
										 |  |  |     })); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  |     it('should gracefully handle ref changing to null and back', | 
					
						
							|  |  |  |       inject([TestBed, AsyncTestCompleter], (tb, async) => { | 
					
						
							|  |  |  |       tb.createView(TestComponent, {html: TEMPLATE}).then((view) => { | 
					
						
							|  |  |  |         view.detectChanges(); | 
					
						
							| 
									
										
										
										
											2015-04-07 20:54:20 -07:00
										 |  |  |         expect(DOM.getText(view.rootNodes[0])).toEqual('1;2;'); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  |         view.context.items = null; | 
					
						
							|  |  |  |         view.detectChanges(); | 
					
						
							| 
									
										
										
										
											2015-04-07 20:54:20 -07:00
										 |  |  |         expect(DOM.getText(view.rootNodes[0])).toEqual(''); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  |         view.context.items = [1, 2, 3]; | 
					
						
							|  |  |  |         view.detectChanges(); | 
					
						
							| 
									
										
										
										
											2015-04-07 20:54:20 -07:00
										 |  |  |         expect(DOM.getText(view.rootNodes[0])).toEqual('1;2;3;'); | 
					
						
							| 
									
										
										
										
											2015-03-13 11:10:11 +01:00
										 |  |  |         async.done(); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  |       }); | 
					
						
							| 
									
										
										
										
											2015-03-13 11:10:11 +01:00
										 |  |  |     })); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  |     it('should throw on ref changing to string', inject([TestBed, AsyncTestCompleter], (tb, async) => { | 
					
						
							|  |  |  |       tb.createView(TestComponent, {html: TEMPLATE}).then((view) => { | 
					
						
							|  |  |  |         view.detectChanges(); | 
					
						
							| 
									
										
										
										
											2015-04-07 20:54:20 -07:00
										 |  |  |         expect(DOM.getText(view.rootNodes[0])).toEqual('1;2;'); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  |         view.context.items = 'whaaa'; | 
					
						
							|  |  |  |         expect(() => view.detectChanges()).toThrowError(); | 
					
						
							| 
									
										
										
										
											2015-03-13 11:10:11 +01:00
										 |  |  |         async.done(); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  |       }); | 
					
						
							| 
									
										
										
										
											2015-03-13 11:10:11 +01:00
										 |  |  |     })); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  |     it('should works with duplicates', inject([TestBed, AsyncTestCompleter], (tb, async) => { | 
					
						
							|  |  |  |       tb.createView(TestComponent, {html: TEMPLATE}).then((view) => { | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  |         var a = new Foo(); | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  |         view.context.items = [a, a]; | 
					
						
							|  |  |  |         view.detectChanges(); | 
					
						
							| 
									
										
										
										
											2015-04-07 20:54:20 -07:00
										 |  |  |         expect(DOM.getText(view.rootNodes[0])).toEqual('foo;foo;'); | 
					
						
							| 
									
										
										
										
											2015-03-13 11:10:11 +01:00
										 |  |  |         async.done(); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  |       }); | 
					
						
							| 
									
										
										
										
											2015-03-13 11:10:11 +01:00
										 |  |  |     })); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  |     it('should repeat over nested arrays', inject([TestBed, AsyncTestCompleter], (tb, async) => { | 
					
						
							|  |  |  |       var template = | 
					
						
							| 
									
										
										
										
											2015-03-13 16:22:01 -07:00
										 |  |  |         '<div>'+ | 
					
						
							|  |  |  |           '<div template="for #item of items">' + | 
					
						
							|  |  |  |             '<div template="for #subitem of item">' + | 
					
						
							|  |  |  |               '{{subitem}}-{{item.length}};' + | 
					
						
							|  |  |  |             '</div>|'+ | 
					
						
							|  |  |  |           '</div>'+ | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  |         '</div>'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       tb.createView(TestComponent, {html: template}).then((view) => { | 
					
						
							|  |  |  |         view.context.items = [['a', 'b'], ['c']]; | 
					
						
							|  |  |  |         view.detectChanges(); | 
					
						
							|  |  |  |         view.detectChanges(); | 
					
						
							|  |  |  |         view.detectChanges(); | 
					
						
							| 
									
										
										
										
											2015-04-07 20:54:20 -07:00
										 |  |  |         expect(DOM.getText(view.rootNodes[0])).toEqual('a-2;b-2;|c-1;|'); | 
					
						
							| 
									
										
										
										
											2015-03-19 10:04:42 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  |         view.context.items = [['e'], ['f', 'g']]; | 
					
						
							|  |  |  |         view.detectChanges(); | 
					
						
							| 
									
										
										
										
											2015-04-07 20:54:20 -07:00
										 |  |  |         expect(DOM.getText(view.rootNodes[0])).toEqual('e-1;|f-2;g-2;|'); | 
					
						
							| 
									
										
										
										
											2015-03-19 10:04:42 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |         async.done(); | 
					
						
							|  |  |  |       }); | 
					
						
							|  |  |  |     })); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  |     it('should repeat over nested arrays with no intermediate element', | 
					
						
							|  |  |  |       inject([TestBed, AsyncTestCompleter], (tb, async) => { | 
					
						
							|  |  |  |       var template = | 
					
						
							| 
									
										
										
										
											2015-03-19 10:04:42 +01:00
										 |  |  |           '<div><template [for] #item [of]="items">' + | 
					
						
							|  |  |  |             '<div template="for #subitem of item">' + | 
					
						
							|  |  |  |             '{{subitem}}-{{item.length}};' + | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  |           '</div></template></div>'; | 
					
						
							| 
									
										
										
										
											2015-03-19 10:04:42 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  |       tb.createView(TestComponent, {html: template}).then((view) => { | 
					
						
							|  |  |  |         view.context.items = [['a', 'b'], ['c']]; | 
					
						
							|  |  |  |         view.detectChanges(); | 
					
						
							| 
									
										
										
										
											2015-04-07 20:54:20 -07:00
										 |  |  |         expect(DOM.getText(view.rootNodes[0])).toEqual('a-2;b-2;c-1;'); | 
					
						
							| 
									
										
										
										
											2015-03-19 10:04:42 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  |         view.context.items = [['e'], ['f', 'g']]; | 
					
						
							|  |  |  |         view.detectChanges(); | 
					
						
							| 
									
										
										
										
											2015-04-07 20:54:20 -07:00
										 |  |  |         expect(DOM.getText(view.rootNodes[0])).toEqual('e-1;f-2;g-2;'); | 
					
						
							| 
									
										
										
										
											2015-03-13 11:10:11 +01:00
										 |  |  |         async.done(); | 
					
						
							|  |  |  |       }); | 
					
						
							|  |  |  |     })); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  |     it('should display indices correctly', | 
					
						
							|  |  |  |       inject([TestBed, AsyncTestCompleter], (tb, async) => { | 
					
						
							|  |  |  |       var template = | 
					
						
							| 
									
										
										
										
											2015-03-13 16:22:01 -07:00
										 |  |  |         '<div><copy-me template="for: var item of items; var i=index">{{i.toString()}}</copy-me></div>'; | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |       tb.createView(TestComponent, {html: template}).then((view) => { | 
					
						
							|  |  |  |         view.context.items = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; | 
					
						
							|  |  |  |         view.detectChanges(); | 
					
						
							| 
									
										
										
										
											2015-04-07 20:54:20 -07:00
										 |  |  |         expect(DOM.getText(view.rootNodes[0])).toEqual('0123456789'); | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-30 17:11:18 +02:00
										 |  |  |         view.context.items = [1, 2, 6, 7, 4, 3, 5, 8, 9, 0]; | 
					
						
							|  |  |  |         view.detectChanges(); | 
					
						
							| 
									
										
										
										
											2015-04-07 20:54:20 -07:00
										 |  |  |         expect(DOM.getText(view.rootNodes[0])).toEqual('0123456789'); | 
					
						
							| 
									
										
										
										
											2015-03-13 11:10:11 +01:00
										 |  |  |         async.done(); | 
					
						
							|  |  |  |       }); | 
					
						
							|  |  |  |     })); | 
					
						
							| 
									
										
										
										
											2015-01-28 00:42:08 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  |   }); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class Foo { | 
					
						
							|  |  |  |   toString() { | 
					
						
							|  |  |  |     return 'foo'; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-12 14:44:59 +01:00
										 |  |  | @Component({selector: 'test-cmp'}) | 
					
						
							| 
									
										
										
										
											2015-04-09 21:20:11 +02:00
										 |  |  | @View({directives: [For]}) | 
					
						
							| 
									
										
										
										
											2014-12-05 17:44:00 -08:00
										 |  |  | class TestComponent { | 
					
						
							|  |  |  |   items: any; | 
					
						
							|  |  |  |   constructor() { | 
					
						
							|  |  |  |     this.items = [1, 2]; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } |