| 
									
										
										
										
											2016-06-23 09:47:54 -07:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @license | 
					
						
							| 
									
										
										
										
											2020-05-19 12:08:49 -07:00
										 |  |  |  * Copyright Google LLC All Rights Reserved. | 
					
						
							| 
									
										
										
										
											2016-06-23 09:47:54 -07:00
										 |  |  |  * | 
					
						
							|  |  |  |  * Use of this source code is governed by an MIT-style license that can be | 
					
						
							|  |  |  |  * found in the LICENSE file at https://angular.io/license
 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-11 15:27:57 -07:00
										 |  |  | import {Component} from '@angular/core'; | 
					
						
							| 
									
										
										
										
											2020-08-01 04:43:18 +09:00
										 |  |  | import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing'; | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-16 14:42:55 -08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  |   describe('binding to CSS class list', () => { | 
					
						
							| 
									
										
										
										
											2017-03-24 09:54:02 -07:00
										 |  |  |     let fixture: ComponentFixture<any>|null; | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-17 08:56:36 -08:00
										 |  |  |     function normalizeClassNames(classes: string) { | 
					
						
							|  |  |  |       return classes.trim().split(' ').sort().join(' '); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |     function detectChangesAndExpectClassName(classes: string): void { | 
					
						
							| 
									
										
										
										
											2020-04-13 16:40:21 -07:00
										 |  |  |       fixture!.detectChanges(); | 
					
						
							|  |  |  |       let nonNormalizedClassName = fixture!.debugElement.children[0].nativeElement.className; | 
					
						
							| 
									
										
										
										
											2017-02-17 08:56:36 -08:00
										 |  |  |       expect(normalizeClassNames(nonNormalizedClassName)).toEqual(normalizeClassNames(classes)); | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-13 16:40:21 -07:00
										 |  |  |     function getComponent(): TestComponent { | 
					
						
							|  |  |  |       return fixture!.debugElement.componentInstance; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-13 16:40:21 -07:00
										 |  |  |     afterEach(() => { | 
					
						
							|  |  |  |       fixture = null; | 
					
						
							|  |  |  |     }); | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |     beforeEach(() => { | 
					
						
							|  |  |  |       TestBed.configureTestingModule({ | 
					
						
							|  |  |  |         declarations: [TestComponent], | 
					
						
							|  |  |  |       }); | 
					
						
							|  |  |  |     }); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-01 04:43:18 +09:00
										 |  |  |     it('should clean up when the directive is destroyed', waitForAsync(() => { | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |          fixture = createTestComponent('<div *ngFor="let item of items" [ngClass]="item"></div>'); | 
					
						
							| 
									
										
										
										
											2016-01-06 14:13:44 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |          getComponent().items = [['0']]; | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |          fixture.detectChanges(); | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |          getComponent().items = [['1']]; | 
					
						
							|  |  |  |          detectChangesAndExpectClassName('1'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |        })); | 
					
						
							| 
									
										
										
										
											2015-07-23 16:22:14 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-21 11:54:21 +02:00
										 |  |  |     describe('expressions evaluating to objects', () => { | 
					
						
							| 
									
										
										
										
											2020-08-01 04:43:18 +09:00
										 |  |  |       it('should add classes specified in an object literal', waitForAsync(() => { | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            fixture = createTestComponent('<div [ngClass]="{foo: true, bar: false}"></div>'); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            detectChangesAndExpectClassName('foo'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |          })); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-24 10:49:47 +02:00
										 |  |  |       it('should add classes specified in an object literal without change in class names', | 
					
						
							| 
									
										
										
										
											2020-08-01 04:43:18 +09:00
										 |  |  |          waitForAsync(() => { | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            fixture = | 
					
						
							|  |  |  |                createTestComponent(`<div [ngClass]="{'foo-bar': true, 'fooBar': true}"></div>`); | 
					
						
							| 
									
										
										
										
											2015-06-21 11:54:21 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            detectChangesAndExpectClassName('foo-bar fooBar'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |          })); | 
					
						
							| 
									
										
										
										
											2015-06-21 11:54:21 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-01 04:43:18 +09:00
										 |  |  |       it('should add and remove classes based on changes in object literal values', | 
					
						
							|  |  |  |          waitForAsync(() => { | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            fixture = | 
					
						
							|  |  |  |                createTestComponent('<div [ngClass]="{foo: condition, bar: !condition}"></div>'); | 
					
						
							| 
									
										
										
										
											2015-06-21 11:54:21 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            detectChangesAndExpectClassName('foo'); | 
					
						
							| 
									
										
										
										
											2015-06-21 11:54:21 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            getComponent().condition = false; | 
					
						
							|  |  |  |            detectChangesAndExpectClassName('bar'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |          })); | 
					
						
							| 
									
										
										
										
											2015-06-21 11:54:21 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-01 04:43:18 +09:00
										 |  |  |       it('should add and remove classes based on changes to the expression object', | 
					
						
							|  |  |  |          waitForAsync(() => { | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            fixture = createTestComponent('<div [ngClass]="objExpr"></div>'); | 
					
						
							| 
									
										
										
										
											2016-11-12 14:08:58 +01:00
										 |  |  |            const objExpr = getComponent().objExpr; | 
					
						
							| 
									
										
										
										
											2015-08-10 12:25:46 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            detectChangesAndExpectClassName('foo'); | 
					
						
							| 
									
										
										
										
											2015-08-10 12:25:46 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-13 16:40:21 -07:00
										 |  |  |            objExpr!['bar'] = true; | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            detectChangesAndExpectClassName('foo bar'); | 
					
						
							| 
									
										
										
										
											2015-08-10 12:25:46 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-13 16:40:21 -07:00
										 |  |  |            objExpr!['baz'] = true; | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            detectChangesAndExpectClassName('foo bar baz'); | 
					
						
							| 
									
										
										
										
											2015-08-10 12:25:46 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-13 16:40:21 -07:00
										 |  |  |            delete (objExpr!['bar']); | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            detectChangesAndExpectClassName('foo baz'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |          })); | 
					
						
							| 
									
										
										
										
											2015-08-10 12:25:46 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |       it('should add and remove classes based on reference changes to the expression object', | 
					
						
							| 
									
										
										
										
											2020-08-01 04:43:18 +09:00
										 |  |  |          waitForAsync(() => { | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            fixture = createTestComponent('<div [ngClass]="objExpr"></div>'); | 
					
						
							| 
									
										
										
										
											2015-11-10 13:30:01 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            detectChangesAndExpectClassName('foo'); | 
					
						
							| 
									
										
										
										
											2015-11-10 13:30:01 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            getComponent().objExpr = {foo: true, bar: true}; | 
					
						
							|  |  |  |            detectChangesAndExpectClassName('foo bar'); | 
					
						
							| 
									
										
										
										
											2015-11-10 13:30:01 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            getComponent().objExpr = {baz: true}; | 
					
						
							|  |  |  |            detectChangesAndExpectClassName('baz'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |          })); | 
					
						
							| 
									
										
										
										
											2015-11-10 13:30:01 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-01 04:43:18 +09:00
										 |  |  |       it('should remove active classes when expression evaluates to null', waitForAsync(() => { | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            fixture = createTestComponent('<div [ngClass]="objExpr"></div>'); | 
					
						
							| 
									
										
										
										
											2015-11-10 13:30:01 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            detectChangesAndExpectClassName('foo'); | 
					
						
							| 
									
										
										
										
											2015-11-10 13:30:01 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            getComponent().objExpr = null; | 
					
						
							|  |  |  |            detectChangesAndExpectClassName(''); | 
					
						
							| 
									
										
										
										
											2015-11-10 13:30:01 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            getComponent().objExpr = {'foo': false, 'bar': true}; | 
					
						
							|  |  |  |            detectChangesAndExpectClassName('bar'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |          })); | 
					
						
							| 
									
										
										
										
											2015-11-10 13:30:01 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-01 04:43:18 +09:00
										 |  |  |       it('should allow multiple classes per expression', waitForAsync(() => { | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            fixture = createTestComponent('<div [ngClass]="objExpr"></div>'); | 
					
						
							| 
									
										
										
										
											2015-11-10 13:30:01 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            getComponent().objExpr = {'bar baz': true, 'bar1 baz1': true}; | 
					
						
							|  |  |  |            detectChangesAndExpectClassName('bar baz bar1 baz1'); | 
					
						
							| 
									
										
										
										
											2015-11-10 13:30:01 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            getComponent().objExpr = {'bar baz': false, 'bar1 baz1': true}; | 
					
						
							|  |  |  |            detectChangesAndExpectClassName('bar1 baz1'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |          })); | 
					
						
							| 
									
										
										
										
											2015-11-10 13:30:01 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-01 04:43:18 +09:00
										 |  |  |       it('should split by one or more spaces between classes', waitForAsync(() => { | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            fixture = createTestComponent('<div [ngClass]="objExpr"></div>'); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            getComponent().objExpr = {'foo bar     baz': true}; | 
					
						
							|  |  |  |            detectChangesAndExpectClassName('foo bar baz'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |          })); | 
					
						
							|  |  |  |     }); | 
					
						
							| 
									
										
										
										
											2015-11-10 13:30:01 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |     describe('expressions evaluating to lists', () => { | 
					
						
							| 
									
										
										
										
											2020-08-01 04:43:18 +09:00
										 |  |  |       it('should add classes specified in a list literal', waitForAsync(() => { | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            fixture = | 
					
						
							|  |  |  |                createTestComponent(`<div [ngClass]="['foo', 'bar', 'foo-bar', 'fooBar']"></div>`); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            detectChangesAndExpectClassName('foo bar foo-bar fooBar'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |          })); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-01 04:43:18 +09:00
										 |  |  |       it('should add and remove classes based on changes to the expression', waitForAsync(() => { | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            fixture = createTestComponent('<div [ngClass]="arrExpr"></div>'); | 
					
						
							| 
									
										
										
										
											2016-11-12 14:08:58 +01:00
										 |  |  |            const arrExpr = getComponent().arrExpr; | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            detectChangesAndExpectClassName('foo'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |            arrExpr.push('bar'); | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            detectChangesAndExpectClassName('foo bar'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |            arrExpr[1] = 'baz'; | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            detectChangesAndExpectClassName('foo baz'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            getComponent().arrExpr = arrExpr.filter((v: string) => v !== 'baz'); | 
					
						
							|  |  |  |            detectChangesAndExpectClassName('foo'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |          })); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-01 04:43:18 +09:00
										 |  |  |       it('should add and remove classes when a reference changes', waitForAsync(() => { | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            fixture = createTestComponent('<div [ngClass]="arrExpr"></div>'); | 
					
						
							|  |  |  |            detectChangesAndExpectClassName('foo'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            getComponent().arrExpr = ['bar']; | 
					
						
							|  |  |  |            detectChangesAndExpectClassName('bar'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |          })); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-01 04:43:18 +09:00
										 |  |  |       it('should take initial classes into account when a reference changes', waitForAsync(() => { | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            fixture = createTestComponent('<div class="foo" [ngClass]="arrExpr"></div>'); | 
					
						
							|  |  |  |            detectChangesAndExpectClassName('foo'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            getComponent().arrExpr = ['bar']; | 
					
						
							|  |  |  |            detectChangesAndExpectClassName('foo bar'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |          })); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-01 04:43:18 +09:00
										 |  |  |       it('should ignore empty or blank class names', waitForAsync(() => { | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            fixture = createTestComponent('<div class="foo" [ngClass]="arrExpr"></div>'); | 
					
						
							|  |  |  |            getComponent().arrExpr = ['', '  ']; | 
					
						
							|  |  |  |            detectChangesAndExpectClassName('foo'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |          })); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-01 04:43:18 +09:00
										 |  |  |       it('should trim blanks from class names', waitForAsync(() => { | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            fixture = createTestComponent('<div class="foo" [ngClass]="arrExpr"></div>'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            getComponent().arrExpr = [' bar  ']; | 
					
						
							|  |  |  |            detectChangesAndExpectClassName('foo bar'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |          })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-01 04:43:18 +09:00
										 |  |  |       it('should allow multiple classes per item in arrays', waitForAsync(() => { | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            fixture = createTestComponent('<div [ngClass]="arrExpr"></div>'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            getComponent().arrExpr = ['foo bar baz', 'foo1 bar1   baz1']; | 
					
						
							|  |  |  |            detectChangesAndExpectClassName('foo bar baz foo1 bar1 baz1'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            getComponent().arrExpr = ['foo bar   baz foobar']; | 
					
						
							|  |  |  |            detectChangesAndExpectClassName('foo bar baz foobar'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |          })); | 
					
						
							| 
									
										
										
										
											2016-11-07 21:23:31 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |       it('should throw with descriptive error message when CSS class is not a string', () => { | 
					
						
							|  |  |  |         fixture = createTestComponent(`<div [ngClass]="['foo', {}]"></div>`); | 
					
						
							| 
									
										
										
										
											2020-04-13 16:40:21 -07:00
										 |  |  |         expect(() => fixture!.detectChanges()) | 
					
						
							| 
									
										
										
										
											2016-11-07 21:23:31 +01:00
										 |  |  |             .toThrowError( | 
					
						
							| 
									
										
										
										
											2019-12-17 15:40:37 -08:00
										 |  |  |                 /NgClass can only toggle CSS classes expressed as strings, got \[object Object\]/); | 
					
						
							| 
									
										
										
										
											2016-11-07 21:23:31 +01:00
										 |  |  |       }); | 
					
						
							| 
									
										
										
										
											2015-06-21 11:54:21 +02:00
										 |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-10-26 09:50:51 -07:00
										 |  |  |     describe('expressions evaluating to sets', () => { | 
					
						
							| 
									
										
										
										
											2020-08-01 04:43:18 +09:00
										 |  |  |       it('should add and remove classes if the set instance changed', waitForAsync(() => { | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            fixture = createTestComponent('<div [ngClass]="setExpr"></div>'); | 
					
						
							|  |  |  |            let setExpr = new Set<string>(); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |            setExpr.add('bar'); | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            getComponent().setExpr = setExpr; | 
					
						
							|  |  |  |            detectChangesAndExpectClassName('bar'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |            setExpr = new Set<string>(); | 
					
						
							|  |  |  |            setExpr.add('baz'); | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            getComponent().setExpr = setExpr; | 
					
						
							|  |  |  |            detectChangesAndExpectClassName('baz'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |          })); | 
					
						
							| 
									
										
										
										
											2015-10-26 09:50:51 -07:00
										 |  |  |     }); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-21 11:54:21 +02:00
										 |  |  |     describe('expressions evaluating to string', () => { | 
					
						
							| 
									
										
										
										
											2020-08-01 04:43:18 +09:00
										 |  |  |       it('should add classes specified in a string literal', waitForAsync(() => { | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            fixture = createTestComponent(`<div [ngClass]="'foo bar foo-bar fooBar'"></div>`); | 
					
						
							|  |  |  |            detectChangesAndExpectClassName('foo bar foo-bar fooBar'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |          })); | 
					
						
							| 
									
										
										
										
											2016-06-08 16:38:52 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-01 04:43:18 +09:00
										 |  |  |       it('should add and remove classes based on changes to the expression', waitForAsync(() => { | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            fixture = createTestComponent('<div [ngClass]="strExpr"></div>'); | 
					
						
							|  |  |  |            detectChangesAndExpectClassName('foo'); | 
					
						
							| 
									
										
										
										
											2015-06-21 11:54:21 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            getComponent().strExpr = 'foo bar'; | 
					
						
							|  |  |  |            detectChangesAndExpectClassName('foo bar'); | 
					
						
							| 
									
										
										
										
											2015-06-21 11:54:21 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            getComponent().strExpr = 'baz'; | 
					
						
							|  |  |  |            detectChangesAndExpectClassName('baz'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |          })); | 
					
						
							| 
									
										
										
										
											2015-06-21 11:54:21 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-01 04:43:18 +09:00
										 |  |  |       it('should remove active classes when switching from string to null', waitForAsync(() => { | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            fixture = createTestComponent(`<div [ngClass]="strExpr"></div>`); | 
					
						
							|  |  |  |            detectChangesAndExpectClassName('foo'); | 
					
						
							| 
									
										
										
										
											2015-07-08 17:41:18 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            getComponent().strExpr = null; | 
					
						
							|  |  |  |            detectChangesAndExpectClassName(''); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |          })); | 
					
						
							| 
									
										
										
										
											2015-07-08 17:41:18 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |       it('should take initial classes into account when switching from string to null', | 
					
						
							| 
									
										
										
										
											2020-08-01 04:43:18 +09:00
										 |  |  |          waitForAsync(() => { | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            fixture = createTestComponent(`<div class="foo" [ngClass]="strExpr"></div>`); | 
					
						
							|  |  |  |            detectChangesAndExpectClassName('foo'); | 
					
						
							| 
									
										
										
										
											2015-07-08 17:41:18 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            getComponent().strExpr = null; | 
					
						
							|  |  |  |            detectChangesAndExpectClassName('foo'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |          })); | 
					
						
							| 
									
										
										
										
											2015-08-10 12:25:46 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-01 04:43:18 +09:00
										 |  |  |       it('should ignore empty and blank strings', waitForAsync(() => { | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            fixture = createTestComponent(`<div class="foo" [ngClass]="strExpr"></div>`); | 
					
						
							|  |  |  |            getComponent().strExpr = ''; | 
					
						
							|  |  |  |            detectChangesAndExpectClassName('foo'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |          })); | 
					
						
							| 
									
										
										
										
											2015-06-21 11:54:21 +02:00
										 |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-10 12:25:46 +02:00
										 |  |  |     describe('cooperation with other class-changing constructs', () => { | 
					
						
							| 
									
										
										
										
											2020-08-01 04:43:18 +09:00
										 |  |  |       it('should co-operate with the class attribute', waitForAsync(() => { | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            fixture = createTestComponent('<div [ngClass]="objExpr" class="init foo"></div>'); | 
					
						
							| 
									
										
										
										
											2016-11-12 14:08:58 +01:00
										 |  |  |            const objExpr = getComponent().objExpr; | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-13 16:40:21 -07:00
										 |  |  |            objExpr!['bar'] = true; | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            detectChangesAndExpectClassName('init foo bar'); | 
					
						
							| 
									
										
										
										
											2015-06-24 13:07:15 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-13 16:40:21 -07:00
										 |  |  |            objExpr!['foo'] = false; | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            detectChangesAndExpectClassName('init bar'); | 
					
						
							| 
									
										
										
										
											2015-08-10 12:25:46 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            getComponent().objExpr = null; | 
					
						
							|  |  |  |            detectChangesAndExpectClassName('init foo'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |          })); | 
					
						
							| 
									
										
										
										
											2015-08-10 12:25:46 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-01 04:43:18 +09:00
										 |  |  |       it('should co-operate with the interpolated class attribute', waitForAsync(() => { | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            fixture = createTestComponent(`<div [ngClass]="objExpr" class="{{'init foo'}}"></div>`); | 
					
						
							| 
									
										
										
										
											2016-11-12 14:08:58 +01:00
										 |  |  |            const objExpr = getComponent().objExpr; | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-13 16:40:21 -07:00
										 |  |  |            objExpr!['bar'] = true; | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            detectChangesAndExpectClassName(`init foo bar`); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-13 16:40:21 -07:00
										 |  |  |            objExpr!['foo'] = false; | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            detectChangesAndExpectClassName(`init bar`); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            getComponent().objExpr = null; | 
					
						
							|  |  |  |            detectChangesAndExpectClassName(`init foo`); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |          })); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-31 17:57:37 +01:00
										 |  |  |       it('should co-operate with the interpolated class attribute when interpolation changes', | 
					
						
							| 
									
										
										
										
											2020-08-01 04:43:18 +09:00
										 |  |  |          waitForAsync(() => { | 
					
						
							| 
									
										
										
										
											2018-01-31 17:57:37 +01:00
										 |  |  |            fixture = createTestComponent( | 
					
						
							|  |  |  |                `<div [ngClass]="{large: false, small: true}" class="{{strExpr}}"></div>`); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |            detectChangesAndExpectClassName(`foo small`); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |            getComponent().strExpr = 'bar'; | 
					
						
							|  |  |  |            detectChangesAndExpectClassName(`bar small`); | 
					
						
							|  |  |  |          })); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-01 04:43:18 +09:00
										 |  |  |       it('should co-operate with the class attribute and binding to it', waitForAsync(() => { | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            fixture = | 
					
						
							|  |  |  |                createTestComponent(`<div [ngClass]="objExpr" class="init" [class]="'foo'"></div>`); | 
					
						
							| 
									
										
										
										
											2016-11-12 14:08:58 +01:00
										 |  |  |            const objExpr = getComponent().objExpr; | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-13 16:40:21 -07:00
										 |  |  |            objExpr!['bar'] = true; | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            detectChangesAndExpectClassName(`init foo bar`); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-13 16:40:21 -07:00
										 |  |  |            objExpr!['foo'] = false; | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            detectChangesAndExpectClassName(`init bar`); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            getComponent().objExpr = null; | 
					
						
							|  |  |  |            detectChangesAndExpectClassName(`init foo`); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |          })); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-01 04:43:18 +09:00
										 |  |  |       it('should co-operate with the class attribute and class.name binding', waitForAsync(() => { | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            const template = | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |                '<div class="init foo" [ngClass]="objExpr" [class.baz]="condition"></div>'; | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            fixture = createTestComponent(template); | 
					
						
							| 
									
										
										
										
											2016-11-12 14:08:58 +01:00
										 |  |  |            const objExpr = getComponent().objExpr; | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            detectChangesAndExpectClassName('init foo baz'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-13 16:40:21 -07:00
										 |  |  |            objExpr!['bar'] = true; | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            detectChangesAndExpectClassName('init foo baz bar'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-13 16:40:21 -07:00
										 |  |  |            objExpr!['foo'] = false; | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            detectChangesAndExpectClassName('init baz bar'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            getComponent().condition = false; | 
					
						
							|  |  |  |            detectChangesAndExpectClassName('init bar'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |          })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       it('should co-operate with initial class and class attribute binding when binding changes', | 
					
						
							| 
									
										
										
										
											2020-08-01 04:43:18 +09:00
										 |  |  |          waitForAsync(() => { | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            const template = '<div class="init" [ngClass]="objExpr" [class]="strExpr"></div>'; | 
					
						
							|  |  |  |            fixture = createTestComponent(template); | 
					
						
							| 
									
										
										
										
											2016-11-12 14:08:58 +01:00
										 |  |  |            const cmp = getComponent(); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            detectChangesAndExpectClassName('init foo'); | 
					
						
							| 
									
										
										
										
											2015-08-10 12:25:46 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-13 16:40:21 -07:00
										 |  |  |            cmp.objExpr!['bar'] = true; | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            detectChangesAndExpectClassName('init foo bar'); | 
					
						
							| 
									
										
										
										
											2015-08-10 12:25:46 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  |            cmp.strExpr = 'baz'; | 
					
						
							|  |  |  |            detectChangesAndExpectClassName('init bar baz foo'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |            cmp.objExpr = null; | 
					
						
							|  |  |  |            detectChangesAndExpectClassName('init baz'); | 
					
						
							| 
									
										
										
										
											2016-08-15 13:52:57 -07:00
										 |  |  |          })); | 
					
						
							| 
									
										
										
										
											2015-08-10 12:25:46 +02:00
										 |  |  |     }); | 
					
						
							| 
									
										
										
										
											2019-12-08 20:19:28 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-11 11:23:53 -08:00
										 |  |  |     describe('prevent regressions', () => { | 
					
						
							| 
									
										
										
										
											2019-12-08 20:19:28 -08:00
										 |  |  |       // https://github.com/angular/angular/issues/34336
 | 
					
						
							| 
									
										
										
										
											2020-01-11 11:23:53 -08:00
										 |  |  |       it('should not write to the native node unless the bound expression has changed', () => { | 
					
						
							|  |  |  |         fixture = createTestComponent(`<div [ngClass]="{'color-red': condition}"></div>`); | 
					
						
							| 
									
										
										
										
											2019-12-08 20:19:28 -08:00
										 |  |  |         detectChangesAndExpectClassName('color-red'); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-11 11:23:53 -08:00
										 |  |  |         // Overwrite CSS classes so that we can check if ngClass performed DOM manipulation to
 | 
					
						
							|  |  |  |         // update it
 | 
					
						
							| 
									
										
										
										
											2019-12-08 20:19:28 -08:00
										 |  |  |         fixture.debugElement.children[0].nativeElement.className = ''; | 
					
						
							| 
									
										
										
										
											2020-01-11 11:23:53 -08:00
										 |  |  |         // Assert that the DOM node still has the same value after change detection
 | 
					
						
							| 
									
										
										
										
											2019-12-08 20:19:28 -08:00
										 |  |  |         detectChangesAndExpectClassName(''); | 
					
						
							| 
									
										
										
										
											2020-01-11 11:23:53 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |         fixture.componentInstance.condition = false; | 
					
						
							|  |  |  |         fixture.detectChanges(); | 
					
						
							|  |  |  |         fixture.componentInstance.condition = true; | 
					
						
							|  |  |  |         detectChangesAndExpectClassName('color-red'); | 
					
						
							| 
									
										
										
										
											2019-12-08 20:19:28 -08:00
										 |  |  |       }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-17 15:40:37 -08:00
										 |  |  |       it('should allow classes with trailing and leading spaces in [ngClass]', () => { | 
					
						
							|  |  |  |         @Component({ | 
					
						
							|  |  |  |           template: `
 | 
					
						
							|  |  |  |             <div leading-space [ngClass]="{' foo': applyClasses}"></div> | 
					
						
							|  |  |  |             <div trailing-space [ngClass]="{'foo ': applyClasses}"></div> | 
					
						
							|  |  |  |           `
 | 
					
						
							|  |  |  |         }) | 
					
						
							|  |  |  |         class Cmp { | 
					
						
							|  |  |  |           applyClasses = true; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         TestBed.configureTestingModule({declarations: [Cmp]}); | 
					
						
							|  |  |  |         const fixture = TestBed.createComponent(Cmp); | 
					
						
							|  |  |  |         fixture.detectChanges(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         const leading = fixture.nativeElement.querySelector('[leading-space]'); | 
					
						
							|  |  |  |         const trailing = fixture.nativeElement.querySelector('[trailing-space]'); | 
					
						
							|  |  |  |         expect(leading.className).toBe('foo'); | 
					
						
							|  |  |  |         expect(trailing.className).toBe('foo'); | 
					
						
							|  |  |  |       }); | 
					
						
							| 
									
										
										
										
											2019-12-08 20:19:28 -08:00
										 |  |  |     }); | 
					
						
							| 
									
										
										
										
											2016-07-21 17:12:00 -07:00
										 |  |  |   }); | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-19 12:51:01 -07:00
										 |  |  | @Component({selector: 'test-cmp', template: ''}) | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  | class TestComponent { | 
					
						
							| 
									
										
										
										
											2015-06-21 11:54:21 +02:00
										 |  |  |   condition: boolean = true; | 
					
						
							| 
									
										
										
										
											2019-12-17 15:40:37 -08:00
										 |  |  |   items: any[]|undefined; | 
					
						
							| 
									
										
										
										
											2015-08-28 11:29:19 -07:00
										 |  |  |   arrExpr: string[] = ['foo']; | 
					
						
							| 
									
										
										
										
											2015-10-26 09:50:51 -07:00
										 |  |  |   setExpr: Set<string> = new Set<string>(); | 
					
						
							| 
									
										
										
										
											2017-03-24 09:54:02 -07:00
										 |  |  |   objExpr: {[klass: string]: any}|null = {'foo': true, 'bar': false}; | 
					
						
							|  |  |  |   strExpr: string|null = 'foo'; | 
					
						
							| 
									
										
										
										
											2015-10-26 09:50:51 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-13 16:40:21 -07:00
										 |  |  |   constructor() { | 
					
						
							|  |  |  |     this.setExpr.add('foo'); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2015-05-26 14:22:35 -07:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2016-09-09 12:03:51 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | function createTestComponent(template: string): ComponentFixture<TestComponent> { | 
					
						
							|  |  |  |   return TestBed.overrideComponent(TestComponent, {set: {template: template}}) | 
					
						
							|  |  |  |       .createComponent(TestComponent); | 
					
						
							| 
									
										
										
										
											2016-11-07 21:23:31 +01:00
										 |  |  | } |