@@ -7,6 +7,9 @@ import { IgxNavigationService } from '../core/navigation/nav.service';
77import { PlatformUtil } from '../core/utils' ;
88import { IgxNavDrawerMiniTemplateDirective , IgxNavDrawerTemplateDirective } from './navigation-drawer.directives' ;
99import { NgIf } from '@angular/common' ;
10+ import { IgxLayoutModule } from '../directives/layout/layout.module' ;
11+ import { IgxNavbarModule } from '../navbar/navbar.module' ;
12+ import { IgxNavbarComponent } from '../navbar/navbar.component' ;
1013
1114// HammerJS simulator from https://github.com/hammerjs/simulator, manual typings TODO
1215declare let Simulator : any ;
@@ -567,6 +570,37 @@ describe('Navigation Drawer', () => {
567570 expect ( fix . componentInstance . navDrawer . element . classList . contains ( 'igx-nav-drawer' ) ) . toBeTruthy ( ) ;
568571 } ) ;
569572
573+ it ( 'should maintain size when mini pinned has `fixed` position' , async ( ) => {
574+ const fix = TestBed . createComponent ( TestFixedMiniComponent ) ;
575+ fix . detectChanges ( ) ;
576+
577+ fix . componentInstance . navDrawer . pin = true ;
578+ fix . detectChanges ( ) ;
579+
580+ // Account for transition duration
581+ await wait ( 350 ) ;
582+
583+ const drawerEl = fix . debugElement . query ( By . directive ( IgxNavigationDrawerComponent ) ) . nativeElement ;
584+ const navbarEl = fix . debugElement . query ( By . directive ( IgxNavbarComponent ) ) . nativeElement ;
585+
586+ let flexBasis = getComputedStyle ( drawerEl ) . getPropertyValue ( 'flex-basis' ) ;
587+
588+ // Mini variant pinned by default
589+ expect ( flexBasis ) . toEqual ( '68px' ) ; ;
590+ expect ( navbarEl . offsetLeft ) . toEqual ( parseInt ( flexBasis ) ) ;
591+
592+ fix . componentInstance . navDrawer . toggle ( ) ;
593+ fix . detectChanges ( ) ;
594+
595+ // Account for transition duration
596+ await wait ( 350 ) ;
597+
598+ flexBasis = getComputedStyle ( drawerEl ) . getPropertyValue ( 'flex-basis' ) ;
599+
600+ expect ( flexBasis ) . toEqual ( '240px' ) ; ;
601+ expect ( navbarEl . offsetLeft ) . toEqual ( parseInt ( flexBasis ) ) ;
602+ } ) ;
603+
570604 const swipe = ( element , posX , posY , duration , deltaX , deltaY ) => {
571605 const swipeOptions = {
572606 deltaX,
@@ -650,3 +684,45 @@ class TestComponentPinComponent extends TestComponentDIComponent {
650684class TestComponentMiniComponent extends TestComponentDIComponent {
651685 public miniView = true ;
652686}
687+
688+ @Component ( {
689+ selector : 'igx--test-fixed-mini' ,
690+ providers : [ IgxNavigationService ] ,
691+ standalone : true ,
692+ imports : [
693+ IgxLayoutModule ,
694+ IgxNavbarModule ,
695+ IgxNavigationDrawerComponent ,
696+ IgxNavDrawerTemplateDirective ,
697+ IgxNavDrawerMiniTemplateDirective ,
698+ NgIf ,
699+ ] ,
700+ styles : `
701+ .igx-nav-drawer__aside--pinned {
702+ position: fixed;
703+ }
704+ ` ,
705+ template : `
706+ <div igxLayout>
707+ <igx-nav-drawer #nav>
708+ <ng-template igxDrawer>
709+ <span igxDrawerItem>Item</span>
710+ </ng-template>
711+
712+ <ng-template igxDrawerMini *ngIf="nav.pin">
713+ <nav>
714+ <span igxDrawerItem>Item</span>
715+ </nav>
716+ </ng-template>
717+ </igx-nav-drawer>
718+
719+ <div igxFlex igxLayout igxLayoutDir="columns">
720+ <igx-navbar title="Navbar" actionButtonIcon="menu" (action)="nav.toggle()">
721+ </igx-navbar>
722+ <div class="main"></div>
723+ </div>
724+ </div>
725+ ` ,
726+ } )
727+ class TestFixedMiniComponent extends TestComponentDIComponent {
728+ }
0 commit comments