Skip to content

Commit

Permalink
test(grid): Change variable name #8978
Browse files Browse the repository at this point in the history
  • Loading branch information
Volen99 committed Sep 20, 2021
1 parent e64f07a commit 9c1392b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -487,9 +487,9 @@ const testMerging = () => {
describe('Test merging', () => {
it('Should merge add transactions correctly', () => {
const data = SampleTestData.personIDNameData();
const addRow4 = { ID: 4, Name: 'Peter' };
const addRow5 = { ID: 5, Name: 'Mimi' };
const addRow6 = { ID: 6, Name: 'Pedro' };
const addRow4 = { ID: 4, IsEmployed: true, Name: 'Peter' };
const addRow5 = { ID: 5, IsEmployed: true, Name: 'Mimi' };
const addRow6 = { ID: 6, IsEmployed: false, Name: 'Pedro' };
const transactions: Transaction[] = [
{ id: addRow4.ID, newValue: addRow4, type: TransactionType.ADD },
{ id: addRow5.ID, newValue: addRow5, type: TransactionType.ADD },
Expand Down
13 changes: 9 additions & 4 deletions projects/igniteui-angular/src/lib/grids/grid/column.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,16 @@ describe('IgxGrid - Column properties #grid', () => {
const grid = fix.componentInstance.grid;
const formatter = fix.componentInstance.multiplier;

const boolFormatter = fix.componentInstance.boolFormatter;

expect(grid.columnList.first.formatter).toBeDefined();

for (let i = 0; i < 3; i++) {
const cell = grid.gridAPI.get_cell_by_index(i, 'ID');
expect(cell.nativeElement.textContent).toMatch(formatter(cell.value));

const cellBool = grid.gridAPI.get_cell_by_index(i, 'IsEmployed');
expect(cellBool.nativeElement.textContent).toMatch(boolFormatter(cellBool.value));
}
});

Expand Down Expand Up @@ -161,18 +166,18 @@ describe('IgxGrid - Column properties #grid', () => {

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

// Swap columns
grid.moveColumn(grid.columnList.first, grid.columnList.last);
fix.detectChanges();

expect(grid.columnList.first.field).toMatch('Name');
expect(grid.columnList.first.field).toMatch('IsEmployed');
expect(grid.columnList.last.field).toMatch('ID');

headers = fix.debugElement.queryAll(By.css(COLUMN_HEADER_CLASS));
expect(headers[0].nativeElement.textContent).toMatch('Name');
expect(headers[1].nativeElement.textContent).toMatch('ID');
expect(headers[0].nativeElement.textContent).toMatch('IsEmployed');
expect(headers[1].nativeElement.textContent).toMatch('Name');
});

it('should support adding and removing columns through a declared iterable', fakeAsync(/** columnList.changes rAF */() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ export class SampleTestData {

/* Data fields: ID: number, Name: string; 3 items. */
public static personIDNameData = () => ([
{ ID: 1, Name: 'Johny' },
{ ID: 2, Name: 'Sally' },
{ ID: 3, Name: 'Tim' }
{ ID: 1, IsEmployed: true, Name: 'Johny' },
{ ID: 2, IsEmployed: true, Name: 'Sally' },
{ ID: 3, IsEmployed: false, Name: 'Tim' },
]);

/* Data fields: FirstName: string, LastName: string, age:number; 3 items. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ export class ColumnDefinitions {

public static idNameFormatter = `
<igx-column field="ID" [formatter]="multiplier"></igx-column>
<igx-column field="IsEmployed" [dataType]="'boolean'"></igx-column>
<igx-column field="Name"></igx-column>
`;

Expand Down

0 comments on commit 9c1392b

Please sign in to comment.