Skip to content

Commit

Permalink
refactor(material/autocomplete): Injects Breakpoint to fix breaking t…
Browse files Browse the repository at this point in the history
…ests

Fixes broken presubmit tests for Angular Component's Autocomplete
constructor by injecting BreakpointObserver rather than adding to the
constructor.

Fixes b/247881646
  • Loading branch information
essjay05 committed May 15, 2024
1 parent e5416aa commit 7567ce5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/material/autocomplete/autocomplete-trigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ export class MatAutocompleteTrigger
private _viewContainerRef: ViewContainerRef,
private _zone: NgZone,
private _changeDetectorRef: ChangeDetectorRef,
private _breakpointObserver: BreakpointObserver,
@Inject(MAT_AUTOCOMPLETE_SCROLL_STRATEGY) scrollStrategy: any,
@Optional() private _dir: Directionality | null,
@Optional() @Inject(MAT_FORM_FIELD) @Host() private _formField: MatFormField | null,
Expand Down Expand Up @@ -881,6 +880,9 @@ export class MatAutocompleteTrigger
});
}

/** Implements BreakpointObserver to be used to detect handset landscape */
private _breakpointObserver = inject(BreakpointObserver);

private _getOverlayPosition(): PositionStrategy {
// Set default Overlay Position
const strategy = this._overlay
Expand Down

0 comments on commit 7567ce5

Please sign in to comment.