This repository was archived by the owner on Sep 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ function MenuProvider($$interimElementProvider) {
5959 if ( options . hasBackdrop ) {
6060 options . backdrop = $mdUtil . createBackdrop ( scope , "md-menu-backdrop md-click-catcher" ) ;
6161
62- $animate . enter ( options . backdrop , $document [ 0 ] . body ) ;
62+ $animate . enter ( options . backdrop , options . backdropParent || $document [ 0 ] . body ) ;
6363 }
6464
6565 /**
Original file line number Diff line number Diff line change @@ -397,6 +397,34 @@ describe('material.components.menu', function() {
397397 $log = $injector . get ( '$log' ) ;
398398 } ) ) ;
399399
400+ it ( 'backdrop should attach to backdropParent' , function ( ) {
401+ var parent = angular . element ( '<div>' ) ;
402+ var menuEl = angular . element (
403+ '<md-menu>' +
404+ ' <button ng-click="null">Trigger</button>' +
405+ '</md-menu>'
406+ ) ;
407+ var backdropParent = angular . element ( '<div>' ) ;
408+
409+ $mdMenu . show ( {
410+ scope : $rootScope ,
411+ element : menuEl ,
412+ target : document . body ,
413+ preserveElement : true ,
414+ parent : parent ,
415+ backdropParent : backdropParent ,
416+ } ) ;
417+
418+ $timeout . flush ( ) ;
419+
420+ expect ( backdropParent . find ( 'md-backdrop' ) . length ) . toBe ( 1 ) ;
421+
422+ // Close the menu and remove the containers
423+ $mdMenu . hide ( ) ;
424+ parent . remove ( ) ;
425+ backdropParent . remove ( ) ;
426+ } ) ;
427+
400428 it ( 'should warn when the md-menu-content element is missing' , function ( ) {
401429 spyOn ( $log , 'warn' ) ;
402430
You can’t perform that action at this time.
0 commit comments