@@ -699,6 +699,50 @@ describe('Row Pinning #grid', () => {
699
699
verifyDOMMatchesLayoutSettings ( gridUnpinnedRow , fix . componentInstance . colGroups ) ;
700
700
} ) ;
701
701
} ) ;
702
+ describe ( ' Hiding' , ( ) => {
703
+ beforeEach ( fakeAsync ( ( ) => {
704
+ fix = TestBed . createComponent ( GridRowPinningComponent ) ;
705
+ fix . detectChanges ( ) ;
706
+ grid = fix . componentInstance . instance ;
707
+ tick ( ) ;
708
+ fix . detectChanges ( ) ;
709
+ } ) ) ;
710
+
711
+ it ( 'should hide columns in pinned and unpinned area' , ( ) => {
712
+ // pin 2nd data row
713
+ grid . pinRow ( fix . componentInstance . data [ 1 ] ) ;
714
+ fix . detectChanges ( ) ;
715
+ const hiddenCol = grid . columns [ 1 ] ;
716
+ hiddenCol . hidden = true ;
717
+ fix . detectChanges ( ) ;
718
+
719
+ const pinnedCells = grid . pinnedRows [ 0 ] . cells ;
720
+ expect ( pinnedCells . filter ( cell => cell . column . field === hiddenCol . field ) . length ) . toBe ( 0 ) ;
721
+
722
+ const unpinnedCells = grid . rowList . first . cells ;
723
+ expect ( unpinnedCells . filter ( cell => cell . column . field === hiddenCol . field ) . length ) . toBe ( 0 ) ;
724
+
725
+ expect ( pinnedCells . length ) . toBe ( unpinnedCells . length ) ;
726
+
727
+ const headerCells = grid . headerCellList ;
728
+ expect ( headerCells . filter ( cell => cell . column . field === hiddenCol . field ) . length ) . toBe ( 0 ) ;
729
+
730
+ expect ( grid . pinnedRows . length ) . toBe ( 1 ) ;
731
+ const pinRowContainer = fix . debugElement . queryAll ( By . css ( FIXED_ROW_CONTAINER ) ) ;
732
+ expect ( pinRowContainer . length ) . toBe ( 1 ) ;
733
+ expect ( pinRowContainer [ 0 ] . children . length ) . toBe ( 1 ) ;
734
+ expect ( pinRowContainer [ 0 ] . children [ 0 ] . context . rowID ) . toBe ( fix . componentInstance . data [ 1 ] ) ;
735
+ expect ( pinRowContainer [ 0 ] . children [ 0 ] . nativeElement ) . toBe ( grid . getRowByIndex ( 0 ) . nativeElement ) ;
736
+
737
+ expect ( grid . getRowByIndex ( 1 ) . rowID ) . toBe ( fix . componentInstance . data [ 0 ] ) ;
738
+ expect ( grid . getRowByIndex ( 2 ) . rowID ) . toBe ( fix . componentInstance . data [ 2 ] ) ;
739
+
740
+ // 1 records pinned + 2px border
741
+ expect ( grid . pinnedRowHeight ) . toBe ( grid . renderedRowHeight + 2 ) ;
742
+ const expectedHeight = parseInt ( grid . height , 10 ) - grid . pinnedRowHeight - 18 - grid . theadRow . nativeElement . offsetHeight ;
743
+ expect ( grid . calcHeight - expectedHeight ) . toBeLessThanOrEqual ( 1 ) ;
744
+ } ) ;
745
+ } ) ;
702
746
} ) ;
703
747
704
748
@Component ( {
0 commit comments