@@ -945,6 +945,28 @@ describe('MDC-based MatAutocomplete', () => {
945945 } ) ;
946946 } ) ;
947947
948+ describe ( 'with theming' , ( ) => {
949+ let fixture : ComponentFixture < SimpleAutocomplete > ;
950+
951+ beforeEach ( ( ) => {
952+ fixture = createComponent ( SimpleAutocomplete ) ;
953+ fixture . detectChanges ( ) ;
954+ } ) ;
955+
956+ it ( 'should transfer the theme to the autocomplete panel' , ( ) => {
957+ fixture . componentInstance . theme = 'warn' ;
958+ fixture . detectChanges ( ) ;
959+
960+ fixture . componentInstance . trigger . openPanel ( ) ;
961+ fixture . detectChanges ( ) ;
962+
963+ const panel = overlayContainerElement . querySelector (
964+ '.mat-mdc-autocomplete-panel' ,
965+ ) ! as HTMLElement ;
966+ expect ( panel . classList ) . toContain ( 'mat-warn' ) ;
967+ } ) ;
968+ } ) ;
969+
948970 describe ( 'keyboard events' , ( ) => {
949971 let fixture : ComponentFixture < SimpleAutocomplete > ;
950972 let input : HTMLInputElement ;
@@ -3393,7 +3415,7 @@ describe('MDC-based MatAutocomplete', () => {
33933415} ) ;
33943416
33953417const SIMPLE_AUTOCOMPLETE_TEMPLATE = `
3396- <mat-form-field [floatLabel]="floatLabel" [style.width.px]="width">
3418+ <mat-form-field [floatLabel]="floatLabel" [style.width.px]="width" [color]="theme" >
33973419 <mat-label *ngIf="hasLabel">State</mat-label>
33983420 <input
33993421 matInput
@@ -3403,7 +3425,6 @@ const SIMPLE_AUTOCOMPLETE_TEMPLATE = `
34033425 [matAutocompleteDisabled]="autocompleteDisabled"
34043426 [formControl]="stateCtrl">
34053427 </mat-form-field>
3406-
34073428 <mat-autocomplete [class]="panelClass" #auto="matAutocomplete" [displayWith]="displayFn"
34083429 [disableRipple]="disableRipple" [aria-label]="ariaLabel" [aria-labelledby]="ariaLabelledby"
34093430 (opened)="openedSpy()" (closed)="closedSpy()">
@@ -3431,6 +3452,7 @@ class SimpleAutocomplete implements OnDestroy {
34313452 ariaLabel : string ;
34323453 ariaLabelledby : string ;
34333454 panelClass = 'class-one class-two' ;
3455+ theme : string ;
34343456 openedSpy = jasmine . createSpy ( 'autocomplete opened spy' ) ;
34353457 closedSpy = jasmine . createSpy ( 'autocomplete closed spy' ) ;
34363458
0 commit comments