@@ -863,10 +863,10 @@ describe('IgxGrid - Column Pinning #grid', () => {
863863 expect ( grid . unpinnedColumns [ 1 ] . field ) . toEqual ( 'ID' ) ;
864864 expect ( grid . getColumnByName ( 'ID' ) . pinned ) . toBeFalsy ( ) ;
865865
866- // move 'ID' column to the left pinned area, before ContractName
867- grid . moveColumn ( grid . getColumnByName ( 'ID' ) , grid . getColumnByName ( 'ContactName' ) , DropPosition . BeforeDropTarget ) ;
868- tick ( ) ;
869- fix . detectChanges ( ) ;
866+ // move 'ID' column to the left pinned area, before ContractName
867+ grid . moveColumn ( grid . getColumnByName ( 'ID' ) , grid . getColumnByName ( 'ContactName' ) , DropPosition . BeforeDropTarget ) ;
868+ tick ( ) ;
869+ fix . detectChanges ( ) ;
870870
871871 // verify column is pinned at the correct place
872872 expect ( grid . pinnedStartColumns [ 0 ] . field ) . toEqual ( 'ID' ) ;
@@ -896,7 +896,7 @@ describe('IgxGrid - Column Pinning #grid', () => {
896896 expect ( cellFax . active ) . toBe ( false ) ;
897897 expect ( cellCompanyName . active ) . toBe ( true ) ;
898898
899- // navigate from left pinned area into unpinned and back
899+ // navigate from left pinned area into unpinned and back
900900 grid . navigation . activeNode = { row : 0 , column : 0 } ;
901901 fix . detectChanges ( ) ;
902902 expect ( grid . getCellByColumn ( 0 , "ContactName" ) . active ) . toBe ( true ) ;
@@ -947,25 +947,33 @@ describe('IgxGrid - Column Pinning #grid', () => {
947947 expect ( grid . getColumnByName ( 'Country' ) . isFirstPinned ) . toBeTruthy ( ) ;
948948 expect ( grid . getColumnByName ( 'ContactTitle' ) . isLastPinned ) . toBeTruthy ( ) ;
949949 const row = grid . gridAPI . get_row_by_index ( 0 ) . nativeElement ;
950- // check pinnedEnd cells are rendered after main display container and have left offset
951- for ( let i = pinnedStart . length ; i <= pinnedStart . length + pinnedEnd . length - 1 ; i ++ ) {
950+ fix . detectChanges ( ) ;
951+ // check pinnedEnd cells are rendered after main display container
952+ const displayContainerBoundingBox = row . querySelector ( 'igx-display-container' ) . getBoundingClientRect ( ) ;
953+ let initialStart = displayContainerBoundingBox . x + displayContainerBoundingBox . width ;
954+ for ( let i = pinnedStart . length ; i <= pinnedStart . length + pinnedEnd . length - 1 ; i ++ ) {
952955 const elem = row . children [ i + 1 ] ;
953- expect ( parseFloat ( ( elem as any ) . style . left ) ) . toBe ( - ( grid . pinnedEndWidth + grid . pinnedStartWidth ) ) ;
956+ const rect = elem . getBoundingClientRect ( ) ;
957+ expect ( rect . x ) . toBe ( initialStart ) ;
958+ initialStart += rect . width
954959 }
955960
956- // check pinnedStart cells are rendered before main display container and have no left offset
957- for ( let i = 0 ; i <= pinnedStart . length - 1 ; i ++ ) {
961+ // check pinnedStart cells are rendered before main display container
962+ initialStart = displayContainerBoundingBox . x ;
963+ for ( let i = pinnedStart . length - 1 ; i >= 0 ; i -- ) {
958964 const elem = row . children [ i ] ;
959- expect ( ( elem as any ) . style . left ) . toBe ( '' ) ;
965+ const rect = elem . getBoundingClientRect ( ) ;
966+ expect ( rect . x + rect . width ) . toBe ( initialStart ) ;
967+ initialStart -= rect . width ;
960968 }
961969
962970 // check correct headers are pinned and in correct order.
963971 const pinnedHeaders = grid . headerGroupsList . filter ( group => group . isPinned ) ;
964972 expect ( pinnedHeaders . length ) . toBe ( 10 ) ;
965973 expect ( pinnedHeaders . map ( x => x . column . header || x . column . field ) )
966- . toEqual ( [ 'General Information' , 'CompanyName' , 'Person Details' ,
967- 'ContactName' , 'ContactTitle' , 'Address Information' ,
968- 'Country' , 'Region' , 'City' , 'Address' ] ) ;
974+ . toEqual ( [ 'General Information' , 'CompanyName' , 'Person Details' ,
975+ 'ContactName' , 'ContactTitle' , 'Address Information' ,
976+ 'Country' , 'Region' , 'City' , 'Address' ] ) ;
969977
970978 } ) ;
971979
0 commit comments