@@ -209,7 +209,9 @@ describe('FocusOriginMonitor', () => {
209
209
. toBe ( 2 , 'button should have exactly 2 focus classes' ) ;
210
210
expect ( changeHandler ) . toHaveBeenCalledWith ( 'program' ) ;
211
211
212
- buttonElement . blur ( ) ;
212
+ // Call `blur` directly because invoking `buttonElement.blur()` does not always trigger the
213
+ // handler on IE11 on SauceLabs.
214
+ focusOriginMonitor . _onBlur ( { } as any , buttonElement ) ;
213
215
fixture . detectChanges ( ) ;
214
216
215
217
expect ( buttonElement . classList . length )
@@ -238,6 +240,7 @@ describe('FocusOriginMonitor', () => {
238
240
239
241
240
242
describe ( 'cdkMonitorFocus' , ( ) => {
243
+ let focusOriginMonitor : FocusOriginMonitor ;
241
244
beforeEach ( async ( ( ) => {
242
245
TestBed . configureTestingModule ( {
243
246
imports : [ StyleModule ] ,
@@ -251,6 +254,10 @@ describe('cdkMonitorFocus', () => {
251
254
TestBed . compileComponents ( ) ;
252
255
} ) ) ;
253
256
257
+ beforeEach ( inject ( [ FocusOriginMonitor ] , ( fom : FocusOriginMonitor ) => {
258
+ focusOriginMonitor = fom ;
259
+ } ) ) ;
260
+
254
261
describe ( 'button with cdkMonitorElementFocus' , ( ) => {
255
262
let fixture : ComponentFixture < ButtonWithFocusClasses > ;
256
263
let buttonElement : HTMLElement ;
@@ -356,7 +363,9 @@ describe('cdkMonitorFocus', () => {
356
363
. toBe ( 2 , 'button should have exactly 2 focus classes' ) ;
357
364
expect ( fixture . componentInstance . focusChanged ) . toHaveBeenCalledWith ( 'program' ) ;
358
365
359
- buttonElement . blur ( ) ;
366
+ // Call `blur` directly because invoking `buttonElement.blur()` does not always trigger the
367
+ // handler on IE11 on SauceLabs.
368
+ focusOriginMonitor . _onBlur ( { } as any , buttonElement ) ;
360
369
fixture . detectChanges ( ) ;
361
370
362
371
expect ( buttonElement . classList . length )
0 commit comments