@@ -130,6 +130,20 @@ describe('MatMenu', () => {
130130 expect ( document . activeElement ) . toBe ( triggerEl ) ;
131131 } ) ) ;
132132
133+ it ( 'should be able to set a custom class on the backdrop' , fakeAsync ( ( ) => {
134+ const fixture = TestBed . createComponent ( SimpleMenu ) ;
135+
136+ fixture . componentInstance . backdropClass = 'custom-backdrop' ;
137+ fixture . detectChanges ( ) ;
138+ fixture . componentInstance . trigger . openMenu ( ) ;
139+ fixture . detectChanges ( ) ;
140+ tick ( 500 ) ;
141+
142+ const backdrop = < HTMLElement > overlayContainerElement . querySelector ( '.cdk-overlay-backdrop' ) ;
143+
144+ expect ( backdrop . classList ) . toContain ( 'custom-backdrop' ) ;
145+ } ) ) ;
146+
133147 it ( 'should restore focus to the root trigger when the menu was opened by mouse' , fakeAsync ( ( ) => {
134148 const fixture = TestBed . createComponent ( SimpleMenu ) ;
135149 fixture . detectChanges ( ) ;
@@ -1336,7 +1350,12 @@ describe('MatMenu default overrides', () => {
13361350@Component ( {
13371351 template : `
13381352 <button [matMenuTriggerFor]="menu" #triggerEl>Toggle menu</button>
1339- <mat-menu class="custom-one custom-two" #menu="matMenu" (closed)="closeCallback($event)">
1353+ <mat-menu
1354+ #menu="matMenu"
1355+ class="custom-one custom-two"
1356+ (closed)="closeCallback($event)"
1357+ [backdropClass]="backdropClass">
1358+
13401359 <button mat-menu-item> Item </button>
13411360 <button mat-menu-item disabled> Disabled </button>
13421361 <button mat-menu-item disableRipple>
@@ -1352,6 +1371,7 @@ class SimpleMenu {
13521371 @ViewChild ( MatMenu ) menu : MatMenu ;
13531372 @ViewChildren ( MatMenuItem ) items : QueryList < MatMenuItem > ;
13541373 closeCallback = jasmine . createSpy ( 'menu closed callback' ) ;
1374+ backdropClass : string ;
13551375}
13561376
13571377@Component ( {
0 commit comments