Skip to content

Commit 56bc8d8

Browse files
committed
test(MRL): verify visible column indexes when hide/show column #7390
1 parent cf80b1e commit 56bc8d8

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

projects/igniteui-angular/src/lib/grids/grid/grid.multi-row-layout.integration.spec.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,43 @@ describe('IgxGrid - multi-row-layout Integration #grid - ', () => {
143143
expect(grid.getColumnByName('ContactTitle').hidden).toBeTruthy();
144144
});
145145

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+
146183
it('should work with horizontal virtualization when some groups are hidden/shown.', async() => {
147184
const uniqueGroups = [
148185
{

0 commit comments

Comments
 (0)