Skip to content

Commit ce86704

Browse files
committed
test(igxGrid): Column spec failing test
Closes #488
1 parent c385a1b commit ce86704

File tree

4 files changed

+5
-12
lines changed

4 files changed

+5
-12
lines changed

projects/igniteui-angular/src/lib/grid/column.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ export class IgxColumnComponent implements AfterContentInit {
400400
if (this.columnGroup) {
401401
this.allChildren.forEach(child => child.pinned = true);
402402
}
403-
// grid.reinitPinStates();
403+
grid.reinitPinStates();
404404

405405
grid.markForCheck();
406406
const newIndex = this.visibleIndex;

projects/igniteui-angular/src/lib/grid/column.spec.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,23 +121,19 @@ describe('IgxGrid - Column properties', () => {
121121
const grid = fix.componentInstance.instance;
122122
let headers: DebugElement[];
123123

124-
expect(grid.columnList.first.index).toEqual(0);
125124
expect(grid.columnList.first.field).toMatch('ID');
126-
expect(grid.columnList.last.index).toEqual(1);
127125
expect(grid.columnList.last.field).toMatch('Name');
128126

129127
headers = fix.debugElement.queryAll(By.css(COLUMN_HEADER_CLASS));
130128
expect(headers[0].nativeElement.textContent).toMatch('ID');
131129
expect(headers[1].nativeElement.textContent).toMatch('Name');
132130

133-
131+
// Swap columns
134132
grid.moveColumn(grid.columnList.first, grid.columnList.last);
135133
fix.detectChanges();
136134

137-
expect(grid.columnList.first.index).toEqual(1);
138-
expect(grid.columnList.first.field).toMatch('ID');
139-
expect(grid.columnList.last.index).toEqual(0);
140-
expect(grid.columnList.last.field).toMatch('Name');
135+
expect(grid.columnList.first.field).toMatch('Name');
136+
expect(grid.columnList.last.field).toMatch('ID');
141137

142138
headers = fix.debugElement.queryAll(By.css(COLUMN_HEADER_CLASS));
143139
expect(headers[0].nativeElement.textContent).toMatch('Name');

projects/igniteui-angular/src/lib/grid/grid.component.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1650,6 +1650,7 @@ export class IgxGridComponent implements OnInit, OnDestroy, AfterContentInit, Af
16501650
protected initColumns(collection: QueryList<IgxColumnComponent>, cb: any = null) {
16511651

16521652
// XXX: Deprecate index
1653+
this._columns = this.columnList.toArray();
16531654

16541655
collection.forEach((column: IgxColumnComponent) => {
16551656
column.gridID = this.id;
@@ -1660,9 +1661,6 @@ export class IgxGridComponent implements OnInit, OnDestroy, AfterContentInit, Af
16601661
cb(column);
16611662
}
16621663
});
1663-
this._columns = this.columnList.toArray();
1664-
// this._pinnedColumns = this.columnList.filter((c) => c.pinned);
1665-
// this._unpinnedColumns = this.columnList.filter((c) => !c.pinned);
16661664
this.reinitPinStates();
16671665
}
16681666

projects/igniteui-angular/src/lib/grid/grid.pinning.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,6 @@ describe('IgxGrid - Column Pinning ', () => {
329329
tryPin = grid.pinColumn('ContactTitle');
330330
fix.detectChanges();
331331
expect(tryPin).toEqual(false);
332-
333332
grid.unpinColumn('ContactName');
334333
fix.detectChanges();
335334

0 commit comments

Comments
 (0)