Skip to content

Commit 2ed81eb

Browse files
committed
debug ie11
1 parent 25a20b5 commit 2ed81eb

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/lib/core/style/focus-origin-monitor.spec.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,9 @@ describe('FocusOriginMonitor', () => {
209209
.toBe(2, 'button should have exactly 2 focus classes');
210210
expect(changeHandler).toHaveBeenCalledWith('program');
211211

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);
213215
fixture.detectChanges();
214216

215217
expect(buttonElement.classList.length)
@@ -238,6 +240,7 @@ describe('FocusOriginMonitor', () => {
238240

239241

240242
describe('cdkMonitorFocus', () => {
243+
let focusOriginMonitor: FocusOriginMonitor;
241244
beforeEach(async(() => {
242245
TestBed.configureTestingModule({
243246
imports: [StyleModule],
@@ -251,6 +254,10 @@ describe('cdkMonitorFocus', () => {
251254
TestBed.compileComponents();
252255
}));
253256

257+
beforeEach(inject([FocusOriginMonitor], (fom: FocusOriginMonitor) => {
258+
focusOriginMonitor = fom;
259+
}));
260+
254261
describe('button with cdkMonitorElementFocus', () => {
255262
let fixture: ComponentFixture<ButtonWithFocusClasses>;
256263
let buttonElement: HTMLElement;
@@ -356,7 +363,9 @@ describe('cdkMonitorFocus', () => {
356363
.toBe(2, 'button should have exactly 2 focus classes');
357364
expect(fixture.componentInstance.focusChanged).toHaveBeenCalledWith('program');
358365

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);
360369
fixture.detectChanges();
361370

362371
expect(buttonElement.classList.length)

src/lib/core/style/focus-origin-monitor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ export class FocusOriginMonitor {
288288
* @param event The blur event.
289289
* @param element The monitored element.
290290
*/
291-
private _onBlur(event: FocusEvent, element: HTMLElement) {
291+
_onBlur(event: FocusEvent, element: HTMLElement) {
292292
// If we are counting child-element-focus as focused, make sure that we aren't just blurring in
293293
// order to focus another child of the monitored element.
294294
const elementInfo = this._elementInfo.get(element);

0 commit comments

Comments
 (0)