@@ -143,6 +143,43 @@ describe('IgxGrid - multi-row-layout Integration #grid - ', () => {
143
143
expect ( grid . getColumnByName ( 'ContactTitle' ) . hidden ) . toBeTruthy ( ) ;
144
144
} ) ;
145
145
146
+ it ( 'verify visible column indexes when hide/show a column' , ( ) => {
147
+
148
+ expect ( grid . getColumnByName ( 'ID' ) . visibleIndex ) . toBe ( 0 ) ;
149
+ expect ( grid . getColumnByName ( 'CompanyName' ) . visibleIndex ) . toBe ( 1 ) ;
150
+ expect ( grid . getColumnByName ( 'ContactName' ) . visibleIndex ) . toBe ( 2 ) ;
151
+ expect ( grid . getColumnByName ( 'ContactTitle' ) . visibleIndex ) . toBe ( 3 ) ;
152
+ // show PostalCode
153
+ grid . getColumnByName ( 'PostalCode' ) . hidden = false ;
154
+ fixture . detectChanges ( ) ;
155
+
156
+ expect ( grid . getColumnByName ( 'ID' ) . visibleIndex ) . toBe ( 1 ) ;
157
+ expect ( grid . getColumnByName ( 'CompanyName' ) . visibleIndex ) . toBe ( 2 ) ;
158
+ expect ( grid . getColumnByName ( 'ContactName' ) . visibleIndex ) . toBe ( 3 ) ;
159
+ expect ( grid . getColumnByName ( 'ContactTitle' ) . visibleIndex ) . toBe ( 6 ) ;
160
+ expect ( grid . getColumnByName ( 'PostalCode' ) . visibleIndex ) . toBe ( 0 ) ;
161
+ expect ( grid . getColumnByName ( 'City' ) . visibleIndex ) . toBe ( 4 ) ;
162
+ expect ( grid . getColumnByName ( 'Country' ) . visibleIndex ) . toBe ( 5 ) ;
163
+ expect ( grid . getColumnByName ( 'Address' ) . visibleIndex ) . toBe ( 7 ) ;
164
+
165
+ // hide PostalCode
166
+ grid . getColumnByName ( 'PostalCode' ) . hidden = true ;
167
+ fixture . detectChanges ( ) ;
168
+ expect ( grid . getColumnByName ( 'PostalCode' ) . visibleIndex ) . toBe ( - 1 ) ;
169
+ expect ( grid . getColumnByName ( 'City' ) . visibleIndex ) . toBe ( - 1 ) ;
170
+ expect ( grid . getColumnByName ( 'Country' ) . visibleIndex ) . toBe ( - 1 ) ;
171
+ expect ( grid . getColumnByName ( 'Address' ) . visibleIndex ) . toBe ( - 1 ) ;
172
+
173
+ // show PostalCode
174
+ grid . getColumnByName ( 'PostalCode' ) . hidden = false ;
175
+ fixture . detectChanges ( ) ;
176
+ expect ( grid . getColumnByName ( 'PostalCode' ) . visibleIndex ) . toBe ( 0 ) ;
177
+ expect ( grid . getColumnByName ( 'City' ) . visibleIndex ) . toBe ( 4 ) ;
178
+ expect ( grid . getColumnByName ( 'Country' ) . visibleIndex ) . toBe ( 5 ) ;
179
+ expect ( grid . getColumnByName ( 'Address' ) . visibleIndex ) . toBe ( 7 ) ;
180
+ } ) ;
181
+
182
+
146
183
it ( 'should work with horizontal virtualization when some groups are hidden/shown.' , async ( ) => {
147
184
const uniqueGroups = [
148
185
{
0 commit comments