11import { Component , DebugElement } from '@angular/core' ;
22import { By } from '@angular/platform-browser' ;
3- import { fakeAsync , ComponentFixture , TestBed } from '@angular/core/testing' ;
3+ import { async , ComponentFixture , TestBed } from '@angular/core/testing' ;
44import { MatChip , MatChipsModule } from './index' ;
5- import { dispatchFakeEvent } from '@angular/cdk/testing' ;
65
76describe ( 'Chip Remove' , ( ) => {
87 let fixture : ComponentFixture < any > ;
98 let testChip : TestChip ;
109 let chipDebugElement : DebugElement ;
1110 let chipNativeElement : HTMLElement ;
1211
13- beforeEach ( fakeAsync ( ( ) => {
12+ beforeEach ( async ( ( ) => {
1413 TestBed . configureTestingModule ( {
1514 imports : [ MatChipsModule ] ,
1615 declarations : [
@@ -19,6 +18,9 @@ describe('Chip Remove', () => {
1918 } ) ;
2019
2120 TestBed . compileComponents ( ) ;
21+ } ) ) ;
22+
23+ beforeEach ( async ( ( ) => {
2224 fixture = TestBed . createComponent ( TestChip ) ;
2325 testChip = fixture . debugElement . componentInstance ;
2426 fixture . detectChanges ( ) ;
@@ -28,14 +30,14 @@ describe('Chip Remove', () => {
2830 } ) ) ;
2931
3032 describe ( 'basic behavior' , ( ) => {
31- it ( 'should apply the `mat-chip-remove` CSS class' , ( ) => {
32- const hrefElement = chipNativeElement . querySelector ( 'a' ) ! ;
33+ it ( 'should applies the `mat-chip-remove` CSS class' , ( ) => {
34+ let hrefElement = chipNativeElement . querySelector ( 'a' ) ! ;
3335
3436 expect ( hrefElement . classList ) . toContain ( 'mat-chip-remove' ) ;
3537 } ) ;
3638
37- it ( 'should emit (remove) on click' , ( ) => {
38- const hrefElement = chipNativeElement . querySelector ( 'a' ) ! ;
39+ it ( 'should emits (remove) on click' , ( ) => {
40+ let hrefElement = chipNativeElement . querySelector ( 'a' ) ! ;
3941
4042 testChip . removable = true ;
4143 fixture . detectChanges ( ) ;
@@ -46,19 +48,6 @@ describe('Chip Remove', () => {
4648
4749 expect ( testChip . didRemove ) . toHaveBeenCalled ( ) ;
4850 } ) ;
49-
50- it ( 'should prevent the default click action' , ( ) => {
51- const hrefElement = chipNativeElement . querySelector ( 'a' ) ! ;
52-
53- testChip . removable = true ;
54- fixture . detectChanges ( ) ;
55-
56- const event = dispatchFakeEvent ( hrefElement , 'click' ) ;
57- fixture . detectChanges ( ) ;
58-
59- expect ( event . defaultPrevented ) . toBe ( true ) ;
60- } ) ;
61-
6251 } ) ;
6352} ) ;
6453
0 commit comments