@@ -21,7 +21,7 @@ describe('IgxSplitter', () => {
2121} ) . compileComponents ( ) ) ) ;
2222 let fixture : ComponentFixture < SplitterTestComponent > ;
2323 let splitter : IgxSplitterComponent ;
24-
24+
2525 beforeEach ( waitForAsync ( ( ) => {
2626 fixture = TestBed . createComponent ( SplitterTestComponent ) ;
2727 fixture . detectChanges ( ) ;
@@ -462,6 +462,76 @@ describe('IgxSplitter pane collapse', () => {
462462 } ) ;
463463} ) ;
464464
465+ describe ( 'IgxSplitter resizing with minSize and browser window is shrinked' , ( ) => {
466+ configureTestSuite ( ) ;
467+ beforeAll ( waitForAsync ( ( ) => TestBed . configureTestingModule ( {
468+ imports : [
469+ SplitterMinSiezComponent
470+ ]
471+ } ) . compileComponents ( ) ) ) ;
472+
473+ let fixture ; let splitter ;
474+ beforeEach ( waitForAsync ( ( ) => {
475+ fixture = TestBed . createComponent ( SplitterMinSiezComponent ) ;
476+ fixture . detectChanges ( ) ;
477+ splitter = fixture . componentInstance . splitter ;
478+ } ) ) ;
479+
480+ it ( 'should set the correct sizes when the user drags one pane to the end of another' , ( ) => {
481+ const pane1 = splitter . panes . toArray ( ) [ 0 ] ;
482+ const pane2 = splitter . panes . toArray ( ) [ 1 ] ;
483+ const splitterBarComponent = fixture . debugElement . query ( By . css ( SPLITTERBAR_CLASS ) ) . context ;
484+ const minSize = parseInt ( pane1 . minSize ) ;
485+ spyOn ( splitter , 'onMoveEnd' ) . and . callThrough ( ) ;
486+
487+ pane1 . size = ( splitter . getTotalSize ( ) - parseInt ( pane2 . size ) ) + 'px' ;
488+ fixture . detectChanges ( ) ;
489+
490+ splitterBarComponent . moveStart . emit ( pane1 ) ;
491+ fixture . detectChanges ( ) ;
492+ splitterBarComponent . movingEnd . emit ( splitter . getTotalSize ( ) - minSize ) ;
493+ fixture . detectChanges ( ) ;
494+
495+ spyOnProperty ( window , 'innerWidth' , 'get' ) . and . returnValue ( 500 ) ;
496+ window . dispatchEvent ( new Event ( 'resize' ) ) ;
497+ splitter . elementRef . nativeElement . style . width = '500px' ;
498+ pane2 . size = ( splitter . getTotalSize ( ) - minSize ) + 'px' ;
499+ fixture . detectChanges ( ) ;
500+
501+ splitterBarComponent . moveStart . emit ( pane1 ) ;
502+ fixture . detectChanges ( ) ;
503+ splitterBarComponent . movingEnd . emit ( - 400 ) ;
504+ fixture . detectChanges ( ) ;
505+
506+ const isFullSize = pane1 . size === '100%' || pane1 . size === ( splitter . getTotalSize ( ) + 'px' ) ;
507+
508+ expect ( splitter . onMoveEnd ) . toHaveBeenCalled ( ) ;
509+ expect ( isFullSize ) . toBeTruthy ( ) ;
510+ } ) ;
511+ } ) ;
512+
513+ @Component ( {
514+ template : `
515+ <igx-splitter>
516+ <igx-splitter-pane minSize="200px">
517+ <div>
518+ Pane 1
519+ </div>
520+ </igx-splitter-pane>
521+ <igx-splitter-pane size="200px">
522+ <div>
523+ Pane 2
524+ </div>
525+ </igx-splitter-pane>
526+ </igx-splitter>
527+ ` ,
528+ imports : [ IgxSplitterComponent , IgxSplitterPaneComponent ]
529+ } )
530+ export class SplitterMinSiezComponent {
531+ @ViewChild ( IgxSplitterComponent , { static : true } )
532+ public splitter : IgxSplitterComponent ;
533+ }
534+
465535@Component ( {
466536 template : `
467537 <igx-splitter [type]="type">
0 commit comments