Skip to content
This repository has been archived by the owner on Feb 2, 2019. It is now read-only.

Commit

Permalink
feat: make visibility input available for sidenav (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregcop1 authored and justindujardin committed Apr 16, 2016
1 parent 99f1500 commit b735650
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ng2-material/components/backdrop/backdrop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export class MdBackdrop {
this.toggle(value);
}

private _visible: boolean = false;
protected _visible: boolean = false;
private _transitioning: boolean = false;
private _previousOverflow: string = null;
private _body: HTMLElement = null;
Expand Down
12 changes: 12 additions & 0 deletions ng2-material/components/sidenav/sidenav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,18 @@ export class MdSidenav extends MdBackdrop implements OnInit, OnDestroy {
private _align: string = SidenavAlignment.LEFT;
private _style: string = SidenavStyle.OVER;

/**
* allow backdrop visibility Input
*/
get visible(): boolean {
return this._visible;
}

@Input()
set visible(value: boolean) {
this.toggle(value);
}

/**
* The backdrop element the container provides.
*/
Expand Down
9 changes: 9 additions & 0 deletions test/components/sidenav/sidenav_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@ export function main() {
}));

});

describe('visible', () => {
it('should accept "true" for content pushing', injectAsync([], () => {
return setup(`<md-sidenav [visible]="true"></md-sidenav>`).then((api: ITestFixture) => {
expect(api.component.visible).toBe(true);
});
}));

});
});
describe('md-sidenav-container', () => {
let template = `
Expand Down

0 comments on commit b735650

Please sign in to comment.