Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit 586aa7a

Browse files
devversionThomasBurleson
authored andcommitted
fix(sidenav): fix is-locked-open backdrop and incorrect backdrop tests
* The md-is-locked-open class-selector wasn't valid, because it wasn't probably privatized * The disabled backdrop tests, weren't valid, because the the sidenav wasn't actually opening. Fixes #7537 Closes #7790
1 parent ae14f25 commit 586aa7a

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

src/components/sidenav/sidenav.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ function SidenavDirective($mdMedia, $mdUtil, $mdConstant, $mdTheming, $animate,
228228
*/
229229
function postLink(scope, element, attr, sidenavCtrl) {
230230
var lastParentOverFlow;
231+
var backdrop;
231232
var triggeringElement = null;
232233
var promise = $q.when(true);
233234
var isLockedOpenParsed = $parse(attr.mdIsLockedOpen);
@@ -240,7 +241,11 @@ function SidenavDirective($mdMedia, $mdUtil, $mdConstant, $mdTheming, $animate,
240241
$mdMedia: $mdMedia
241242
});
242243
};
243-
var backdrop = !angular.isDefined(attr.mdDisableBackdrop) ? $mdUtil.createBackdrop(scope, "_md-sidenav-backdrop md-opaque ng-enter") : undefined;
244+
245+
// Only create the backdrop if the backdrop isn't disabled.
246+
if (!angular.isDefined(attr.mdDisableBackdrop)) {
247+
backdrop = $mdUtil.createBackdrop(scope, "_md-sidenav-backdrop md-opaque ng-enter");
248+
}
244249

245250
$mdTheming(element);
246251

src/components/sidenav/sidenav.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ md-sidenav {
7070

7171
@extend .md-sidenav-left;
7272
}
73-
.md-sidenav-backdrop._md-locked-open {
73+
._md-sidenav-backdrop._md-locked-open {
7474
display: none;
7575
}
7676

src/components/sidenav/sidenav.spec.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,18 @@ describe('mdSidenav', function() {
5252
expect($rootScope.show).toBe(false);
5353
}));
5454

55-
it('should show no backdrop if disabled', inject(function($rootScope, $material, $timeout) {
56-
var el = setup('md-disable-backdrop="true"');
55+
it('should show a backdrop by default', inject(function($rootScope, $material) {
56+
var el = setup('md-is-open="show"');
5757
$rootScope.$apply('show = true');
5858

5959
$material.flushOutstandingAnimations();
6060

6161
var backdrop = el.parent().find('md-backdrop');
62-
expect(backdrop.length).toBe(0);
62+
expect(backdrop.length).toBe(1);
6363
}));
6464

65-
it('should show no backdrop if disabled', inject(function($rootScope, $material, $timeout) {
66-
var el = setup('md-disable-backdrop');
65+
it('should not show a backdrop if md-disable-backdrop is set to true', inject(function($rootScope, $material) {
66+
var el = setup('md-is-open="show" md-disable-backdrop');
6767
$rootScope.$apply('show = true');
6868

6969
$material.flushOutstandingAnimations();

0 commit comments

Comments
 (0)