From 0e0ff0e7aae4a4f87ad92e17bc1af14e20a3e17a Mon Sep 17 00:00:00 2001 From: Kara Date: Wed, 21 Sep 2016 14:40:34 -0700 Subject: [PATCH] fix(sidenav): align text at start (#1297) --- src/lib/sidenav/sidenav.spec.ts | 9 +++++++++ src/lib/sidenav/sidenav.ts | 2 ++ 2 files changed, 11 insertions(+) diff --git a/src/lib/sidenav/sidenav.spec.ts b/src/lib/sidenav/sidenav.spec.ts index 7b56aa9fbe3c..712fe2129c89 100644 --- a/src/lib/sidenav/sidenav.spec.ts +++ b/src/lib/sidenav/sidenav.spec.ts @@ -226,6 +226,15 @@ describe('MdSidenav', () => { expect(sidenavEl.classList).toContain('md-sidenav-opened'); }); + it('should remove align attr from DOM', () => { + const fixture = TestBed.createComponent(BasicTestApp); + fixture.detectChanges(); + + const sidenavEl = fixture.debugElement.query(By.css('md-sidenav')).nativeElement; + expect(sidenavEl.hasAttribute('align')) + .toBe(false, 'Expected sidenav not to have a native align attribute.'); + }); + }); }); diff --git a/src/lib/sidenav/sidenav.ts b/src/lib/sidenav/sidenav.ts index 06e82339e0d1..1d566cad0577 100644 --- a/src/lib/sidenav/sidenav.ts +++ b/src/lib/sidenav/sidenav.ts @@ -38,6 +38,8 @@ export class MdDuplicatedSidenavError extends MdError { template: '', host: { '(transitionend)': '_onTransitionEnd($event)', + // must prevent the browser from aligning text based on value + '[attr.align]': 'null' }, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None,