@@ -945,6 +945,28 @@ describe('MDC-based MatAutocomplete', () => {
945
945
} ) ;
946
946
} ) ;
947
947
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
+
948
970
describe ( 'keyboard events' , ( ) => {
949
971
let fixture : ComponentFixture < SimpleAutocomplete > ;
950
972
let input : HTMLInputElement ;
@@ -3393,7 +3415,7 @@ describe('MDC-based MatAutocomplete', () => {
3393
3415
} ) ;
3394
3416
3395
3417
const 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" >
3397
3419
<mat-label *ngIf="hasLabel">State</mat-label>
3398
3420
<input
3399
3421
matInput
@@ -3403,7 +3425,6 @@ const SIMPLE_AUTOCOMPLETE_TEMPLATE = `
3403
3425
[matAutocompleteDisabled]="autocompleteDisabled"
3404
3426
[formControl]="stateCtrl">
3405
3427
</mat-form-field>
3406
-
3407
3428
<mat-autocomplete [class]="panelClass" #auto="matAutocomplete" [displayWith]="displayFn"
3408
3429
[disableRipple]="disableRipple" [aria-label]="ariaLabel" [aria-labelledby]="ariaLabelledby"
3409
3430
(opened)="openedSpy()" (closed)="closedSpy()">
@@ -3431,6 +3452,7 @@ class SimpleAutocomplete implements OnDestroy {
3431
3452
ariaLabel : string ;
3432
3453
ariaLabelledby : string ;
3433
3454
panelClass = 'class-one class-two' ;
3455
+ theme : string ;
3434
3456
openedSpy = jasmine . createSpy ( 'autocomplete opened spy' ) ;
3435
3457
closedSpy = jasmine . createSpy ( 'autocomplete closed spy' ) ;
3436
3458
0 commit comments