1
- import { async , TestBed , ComponentFixture } from '@angular/core/testing' ;
1
+ import { async , TestBed , ComponentFixture , inject } from '@angular/core/testing' ;
2
2
import { Component , DebugElement } from '@angular/core' ;
3
3
import { By } from '@angular/platform-browser' ;
4
4
import { MdSelectionList , MdListOption , MdListModule } from './index' ;
@@ -169,6 +169,7 @@ describe('test selection list with single option', () => {
169
169
let listOption : DebugElement ;
170
170
let listItemEl : DebugElement ;
171
171
let selectionList : DebugElement ;
172
+ let platform : Platform ;
172
173
173
174
beforeEach ( async ( ( ) => {
174
175
TestBed . configureTestingModule ( {
@@ -192,12 +193,16 @@ describe('test selection list with single option', () => {
192
193
fixture . detectChanges ( ) ;
193
194
} ) ) ;
194
195
196
+ beforeEach ( inject ( [ Platform ] , ( p : Platform ) => {
197
+ platform = p ;
198
+ } ) ) ;
199
+
195
200
it ( 'should be focused when focus on nativeElements' , ( ) => {
196
201
listOption . nativeElement . focus ( ) ;
197
202
fixture . detectChanges ( ) ;
198
203
199
204
expect ( listItemEl . nativeElement ) . toBe ( document . activeElement ) ;
200
- if ( ! fixture . componentInstance . isIE ) {
205
+ if ( ! platform . IS_TRIDENT ) {
201
206
expect ( listItemEl . nativeElement . className ) . toContain ( 'mat-list-item-focus' ) ;
202
207
}
203
208
@@ -345,12 +350,4 @@ class SelectionListWithListDisabled {
345
350
</md-list-option>
346
351
</mat-selection-list>` } )
347
352
class SelectionListWithOnlyOneOption {
348
- isIE : boolean = true ;
349
- constructor ( public platform : Platform ) {
350
- if ( platform . SAFARI || platform . EDGE || platform . FIREFOX ) {
351
- this . isIE = false ;
352
- } else {
353
- this . isIE = true ;
354
- }
355
- }
356
353
}
0 commit comments