@@ -483,6 +483,7 @@ describe('MatDrawerContainer', () => {
483
483
DrawerSetToOpenedTrue ,
484
484
DrawerContainerStateChangesTestApp ,
485
485
AutosizeDrawer ,
486
+ BasicTestApp ,
486
487
] ,
487
488
} ) ;
488
489
@@ -630,6 +631,18 @@ describe('MatDrawerContainer', () => {
630
631
discardPeriodicTasks ( ) ;
631
632
} ) ) ;
632
633
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
+
633
646
} ) ;
634
647
635
648
@@ -652,13 +665,13 @@ class DrawerContainerTwoDrawerTestApp {
652
665
/** Test component that contains an MatDrawerContainer and one MatDrawer. */
653
666
@Component ( {
654
667
template : `
655
- <mat-drawer-container (backdropClick)="backdropClicked()">
668
+ <mat-drawer-container (backdropClick)="backdropClicked()" [hasBackdrop]="hasBackdrop" >
656
669
<mat-drawer #drawer position="start"
657
670
(opened)="open()"
658
671
(openedStart)="openStart()"
659
672
(closed)="close()"
660
673
(closedStart)="closeStart()">
661
- <button #drawerButton>Content. </button>
674
+ <button #drawerButton>Content</button>
662
675
</mat-drawer>
663
676
<button (click)="drawer.open()" class="open" #openButton></button>
664
677
<button (click)="drawer.close()" class="close" #closeButton></button>
@@ -670,6 +683,7 @@ class BasicTestApp {
670
683
closeCount = 0 ;
671
684
closeStartCount = 0 ;
672
685
backdropClickedCount = 0 ;
686
+ hasBackdrop = true ;
673
687
674
688
@ViewChild ( 'drawerButton' ) drawerButton : ElementRef ;
675
689
@ViewChild ( 'openButton' ) openButton : ElementRef ;
0 commit comments