@@ -483,6 +483,7 @@ describe('MatDrawerContainer', () => {
483483 DrawerSetToOpenedTrue ,
484484 DrawerContainerStateChangesTestApp ,
485485 AutosizeDrawer ,
486+ BasicTestApp ,
486487 ] ,
487488 } ) ;
488489
@@ -630,6 +631,18 @@ describe('MatDrawerContainer', () => {
630631 discardPeriodicTasks ( ) ;
631632 } ) ) ;
632633
634+ it ( 'should be able to toggle whether the container has a backdrop' , fakeAsync ( ( ) => {
635+ const fixture = TestBed . createComponent ( BasicTestApp ) ;
636+ fixture . detectChanges ( ) ;
637+
638+ expect ( fixture . nativeElement . querySelector ( '.mat-drawer-backdrop' ) ) . toBeTruthy ( ) ;
639+
640+ fixture . componentInstance . hasBackdrop = false ;
641+ fixture . detectChanges ( ) ;
642+
643+ expect ( fixture . nativeElement . querySelector ( '.mat-drawer-backdrop' ) ) . toBeFalsy ( ) ;
644+ } ) ) ;
645+
633646} ) ;
634647
635648
@@ -652,13 +665,13 @@ class DrawerContainerTwoDrawerTestApp {
652665/** Test component that contains an MatDrawerContainer and one MatDrawer. */
653666@Component ( {
654667 template : `
655- <mat-drawer-container (backdropClick)="backdropClicked()">
668+ <mat-drawer-container (backdropClick)="backdropClicked()" [hasBackdrop]="hasBackdrop" >
656669 <mat-drawer #drawer position="start"
657670 (opened)="open()"
658671 (openedStart)="openStart()"
659672 (closed)="close()"
660673 (closedStart)="closeStart()">
661- <button #drawerButton>Content. </button>
674+ <button #drawerButton>Content</button>
662675 </mat-drawer>
663676 <button (click)="drawer.open()" class="open" #openButton></button>
664677 <button (click)="drawer.close()" class="close" #closeButton></button>
@@ -670,6 +683,7 @@ class BasicTestApp {
670683 closeCount = 0 ;
671684 closeStartCount = 0 ;
672685 backdropClickedCount = 0 ;
686+ hasBackdrop = true ;
673687
674688 @ViewChild ( 'drawerButton' ) drawerButton : ElementRef ;
675689 @ViewChild ( 'openButton' ) openButton : ElementRef ;
0 commit comments