diff --git a/src/material-experimental/mdc-autocomplete/autocomplete.spec.ts b/src/material-experimental/mdc-autocomplete/autocomplete.spec.ts index 2489b0001024..a763addaa700 100644 --- a/src/material-experimental/mdc-autocomplete/autocomplete.spec.ts +++ b/src/material-experimental/mdc-autocomplete/autocomplete.spec.ts @@ -1396,23 +1396,22 @@ describe('MDC-based MatAutocomplete', () => { .toBeFalsy(); })); - it('should not close when a click event occurs on the outside while the panel has focus', - fakeAsync(() => { - const trigger = fixture.componentInstance.trigger; + it('should not close when a click event occurs on the outside while the panel has focus', fakeAsync(() => { + const trigger = fixture.componentInstance.trigger; - input.focus(); - flush(); - fixture.detectChanges(); + input.focus(); + flush(); + fixture.detectChanges(); - expect(document.activeElement).toBe(input, 'Expected input to be focused.'); - expect(trigger.panelOpen).toBe(true, 'Expected panel to be open.'); + expect(document.activeElement).toBe(input, 'Expected input to be focused.'); + expect(trigger.panelOpen).toBe(true, 'Expected panel to be open.'); - dispatchMouseEvent(document.body, 'click'); - fixture.detectChanges(); + dispatchMouseEvent(document.body, 'click'); + fixture.detectChanges(); - expect(document.activeElement).toBe(input, 'Expected input to continue to be focused.'); - expect(trigger.panelOpen).toBe(true, 'Expected panel to stay open.'); - })); + expect(document.activeElement).toBe(input, 'Expected input to continue to be focused.'); + expect(trigger.panelOpen).toBe(true, 'Expected panel to stay open.'); + })); it('should reset the active option when closing with the escape key', fakeAsync(() => { const trigger = fixture.componentInstance.trigger; diff --git a/src/material/autocomplete/autocomplete.spec.ts b/src/material/autocomplete/autocomplete.spec.ts index 136aa58aae05..1fa9b9db4810 100644 --- a/src/material/autocomplete/autocomplete.spec.ts +++ b/src/material/autocomplete/autocomplete.spec.ts @@ -1379,23 +1379,22 @@ describe('MatAutocomplete', () => { .toBeFalsy(); })); - it('should not close when a click event occurs on the outside while the panel has focus', - fakeAsync(() => { - const trigger = fixture.componentInstance.trigger; + it('should not close when a click event occurs on the outside while the panel has focus', fakeAsync(() => { + const trigger = fixture.componentInstance.trigger; - input.focus(); - flush(); - fixture.detectChanges(); + input.focus(); + flush(); + fixture.detectChanges(); - expect(document.activeElement).toBe(input, 'Expected input to be focused.'); - expect(trigger.panelOpen).toBe(true, 'Expected panel to be open.'); + expect(document.activeElement).toBe(input, 'Expected input to be focused.'); + expect(trigger.panelOpen).toBe(true, 'Expected panel to be open.'); - dispatchMouseEvent(document.body, 'click'); - fixture.detectChanges(); + dispatchMouseEvent(document.body, 'click'); + fixture.detectChanges(); - expect(document.activeElement).toBe(input, 'Expected input to continue to be focused.'); - expect(trigger.panelOpen).toBe(true, 'Expected panel to stay open.'); - })); + expect(document.activeElement).toBe(input, 'Expected input to continue to be focused.'); + expect(trigger.panelOpen).toBe(true, 'Expected panel to stay open.'); + })); it('should reset the active option when closing with the escape key', fakeAsync(() => { const trigger = fixture.componentInstance.trigger;