@@ -611,6 +611,50 @@ describe('Row Pinning #grid', () => {
611611 verifyDOMMatchesLayoutSettings ( gridUnpinnedRow , fix . componentInstance . colGroups ) ;
612612 } ) ;
613613 } ) ;
614+ describe ( ' Hiding' , ( ) => {
615+ beforeEach ( fakeAsync ( ( ) => {
616+ fix = TestBed . createComponent ( GridRowPinningComponent ) ;
617+ fix . detectChanges ( ) ;
618+ grid = fix . componentInstance . instance ;
619+ tick ( ) ;
620+ fix . detectChanges ( ) ;
621+ } ) ) ;
622+
623+ it ( 'should hide columns in pinned and unpinned area' , ( ) => {
624+ // pin 2nd data row
625+ grid . pinRow ( fix . componentInstance . data [ 1 ] ) ;
626+ fix . detectChanges ( ) ;
627+ const hiddenCol = grid . columns [ 1 ] ;
628+ hiddenCol . hidden = true ;
629+ fix . detectChanges ( ) ;
630+
631+ const pinnedCells = grid . pinnedRows [ 0 ] . cells ;
632+ expect ( pinnedCells . filter ( cell => cell . column . field === hiddenCol . field ) . length ) . toBe ( 0 ) ;
633+
634+ const unpinnedCells = grid . rowList . first . cells ;
635+ expect ( unpinnedCells . filter ( cell => cell . column . field === hiddenCol . field ) . length ) . toBe ( 0 ) ;
636+
637+ expect ( pinnedCells . length ) . toBe ( unpinnedCells . length ) ;
638+
639+ const headerCells = grid . headerCellList ;
640+ expect ( headerCells . filter ( cell => cell . column . field === hiddenCol . field ) . length ) . toBe ( 0 ) ;
641+
642+ expect ( grid . pinnedRows . length ) . toBe ( 1 ) ;
643+ const pinRowContainer = fix . debugElement . queryAll ( By . css ( FIXED_ROW_CONTAINER ) ) ;
644+ expect ( pinRowContainer . length ) . toBe ( 1 ) ;
645+ expect ( pinRowContainer [ 0 ] . children . length ) . toBe ( 1 ) ;
646+ expect ( pinRowContainer [ 0 ] . children [ 0 ] . context . rowID ) . toBe ( fix . componentInstance . data [ 1 ] ) ;
647+ expect ( pinRowContainer [ 0 ] . children [ 0 ] . nativeElement ) . toBe ( grid . getRowByIndex ( 0 ) . nativeElement ) ;
648+
649+ expect ( grid . getRowByIndex ( 1 ) . rowID ) . toBe ( fix . componentInstance . data [ 0 ] ) ;
650+ expect ( grid . getRowByIndex ( 2 ) . rowID ) . toBe ( fix . componentInstance . data [ 2 ] ) ;
651+
652+ // 1 records pinned + 2px border
653+ expect ( grid . pinnedRowHeight ) . toBe ( grid . renderedRowHeight + 2 ) ;
654+ const expectedHeight = parseInt ( grid . height , 10 ) - grid . pinnedRowHeight - 18 - grid . theadRow . nativeElement . offsetHeight ;
655+ expect ( grid . calcHeight - expectedHeight ) . toBeLessThanOrEqual ( 1 ) ;
656+ } ) ;
657+ } ) ;
614658} ) ;
615659
616660@Component ( {
0 commit comments