@@ -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,75 @@ 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+ splitter . elementRef . nativeElement . style . width = '500px' ;
496+ pane2 . size = ( splitter . getTotalSize ( ) - minSize ) + 'px' ;
497+ fixture . detectChanges ( ) ;
498+
499+ splitterBarComponent . moveStart . emit ( pane1 ) ;
500+ fixture . detectChanges ( ) ;
501+ splitterBarComponent . movingEnd . emit ( - 400 ) ;
502+ fixture . detectChanges ( ) ;
503+
504+ const isFullSize = pane1 . size === '100%' || pane1 . size === ( splitter . getTotalSize ( ) + 'px' ) ;
505+
506+ expect ( splitter . onMoveEnd ) . toHaveBeenCalled ( ) ;
507+ expect ( isFullSize ) . toBeTruthy ( ) ;
508+ } ) ;
509+ } ) ;
510+
511+ @Component ( {
512+ template : `
513+ <igx-splitter>
514+ <igx-splitter-pane minSize="200px">
515+ <div>
516+ Pane 1
517+ </div>
518+ </igx-splitter-pane>
519+ <igx-splitter-pane size="200px">
520+ <div>
521+ Pane 2
522+ </div>
523+ </igx-splitter-pane>
524+ </igx-splitter>
525+ ` ,
526+ standalone : true ,
527+ imports : [ IgxSplitterComponent , IgxSplitterPaneComponent ]
528+ } )
529+ export class SplitterMinSiezComponent {
530+ @ViewChild ( IgxSplitterComponent , { static : true } )
531+ public splitter : IgxSplitterComponent ;
532+ }
533+
465534@Component ( {
466535 template : `
467536 <igx-splitter [type]="type">
0 commit comments