|
| 1 | +import {async, ComponentFixture, TestBed} from '@angular/core/testing'; |
| 2 | +import {Component, DebugElement} from '@angular/core'; |
| 3 | +import {By} from '@angular/platform-browser'; |
| 4 | +import {MdChipList, MdChipsModule} from './index'; |
| 5 | + |
| 6 | +describe('MdChip', () => { |
| 7 | + let fixture: ComponentFixture<any>; |
| 8 | + |
| 9 | + beforeEach(async(() => { |
| 10 | + TestBed.configureTestingModule({ |
| 11 | + imports: [MdChipsModule.forRoot()], |
| 12 | + declarations: [ |
| 13 | + StaticChipList |
| 14 | + ] |
| 15 | + }); |
| 16 | + |
| 17 | + TestBed.compileComponents(); |
| 18 | + })); |
| 19 | + |
| 20 | + describe('basic behaviors', () => { |
| 21 | + let chipListDebugElement: DebugElement; |
| 22 | + let chipListNativeElement: HTMLElement; |
| 23 | + let chipListInstance: MdChipList; |
| 24 | + let testComponent: StaticChipList; |
| 25 | + |
| 26 | + beforeEach(() => { |
| 27 | + fixture = TestBed.createComponent(StaticChipList); |
| 28 | + fixture.detectChanges(); |
| 29 | + |
| 30 | + chipListDebugElement = fixture.debugElement.query(By.directive(MdChipList)); |
| 31 | + chipListNativeElement = chipListDebugElement.nativeElement; |
| 32 | + chipListInstance = chipListDebugElement.componentInstance; |
| 33 | + testComponent = fixture.debugElement.componentInstance; |
| 34 | + }); |
| 35 | + |
| 36 | + it('adds the `md-chip-list` class', () => { |
| 37 | + expect(chipListNativeElement.classList).toContain('md-chip-list'); |
| 38 | + }); |
| 39 | + }); |
| 40 | +}); |
| 41 | + |
| 42 | +@Component({ |
| 43 | + template: ` |
| 44 | + <md-chip-list> |
| 45 | + <md-chip>{{name}} 1</md-chip> |
| 46 | + <md-chip>{{name}} 2</md-chip> |
| 47 | + <md-chip>{{name}} 3</md-chip> |
| 48 | + </md-chip-list> |
| 49 | + ` |
| 50 | +}) |
| 51 | +class StaticChipList { |
| 52 | + name: 'Test'; |
| 53 | +} |
0 commit comments