Skip to content

Commit 0a3dcf5

Browse files
authored
Merge pull request #6611 from IgniteUI/mvenkov/host-bind-correctly-class-in-nav-drawer-8.2.x
Retain classes added through markup in IgxNavDrawer 8.2.x
2 parents c82a959 + d40cf6c commit 0a3dcf5

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

projects/igniteui-angular/src/lib/navigation-drawer/navigation-drawer.component.spec.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,14 @@ describe('Navigation Drawer', () => {
571571
done();
572572
});
573573

574+
it('should retain classes added in markup, fix for #6508', () => {
575+
const fix = TestBed.createComponent(TestComponent);
576+
fix.detectChanges();
577+
578+
expect(fix.componentInstance.navDrawer.element.classList.contains('markupClass')).toBeTruthy();
579+
expect(fix.componentInstance.navDrawer.element.classList.contains('igx-nav-drawer')).toBeTruthy();
580+
});
581+
574582
function swipe(element, posX, posY, duration, deltaX, deltaY) {
575583
const swipeOptions = {
576584
deltaX,
@@ -610,7 +618,7 @@ describe('Navigation Drawer', () => {
610618

611619
@Component({
612620
selector: 'igx-test-cmp',
613-
template: '<igx-nav-drawer></igx-nav-drawer>'
621+
template: '<igx-nav-drawer class="markupClass"></igx-nav-drawer>'
614622
})
615623
class TestComponent {
616624
@ViewChild(IgxNavigationDrawerComponent, { static: true }) public navDrawer: IgxNavigationDrawerComponent;

projects/igniteui-angular/src/lib/navigation-drawer/navigation-drawer.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,12 @@ export class IgxNavigationDrawerComponent implements
6161
AfterContentInit,
6262
OnDestroy,
6363
OnChanges {
64+
6465
private _isOpen = false;
65-
@HostBinding('class') public cssClass = 'igx-nav-drawer';
66+
67+
/** @hidden @internal */
68+
@HostBinding('class.igx-nav-drawer')
69+
public cssClass = true;
6670

6771
/**
6872
* ID of the component

0 commit comments

Comments
 (0)