Skip to content

Commit 0182cce

Browse files
IvayloGLipata
authored andcommitted
chore(select): Update test #6198 (#6217)
1 parent e569f09 commit 0182cce

File tree

1 file changed

+27
-45
lines changed

1 file changed

+27
-45
lines changed

projects/igniteui-angular/src/lib/select/select.component.spec.ts

Lines changed: 27 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2475,23 +2475,23 @@ describe('igxSelect', () => {
24752475
fixture.detectChanges();
24762476
tick();
24772477
}));
2478-
it('Should NOT throw console Warning for "Expression changed after it was checked"', fakeAsync(() => {
2479-
const firstSelect = fixture.componentInstance.selectComponents.first as IgxSelectComponent;
2480-
spyOn(console, 'warn');
2478+
it('Should NOT throw console Warning for "Expression changed after it was checked"', () => {
2479+
let selectCDR = fixture.componentInstance.select;
24812480

2482-
expect(firstSelect).toBeDefined();
2483-
expect(firstSelect.value).toBe('ID');
2484-
expect(console.warn).toHaveBeenCalledTimes(0);
2481+
expect(selectCDR).toBeDefined();
2482+
expect(selectCDR.value).toBe('ID');
24852483

24862484
fixture.componentInstance.render = !fixture.componentInstance.render;
24872485
fixture.detectChanges();
2488-
tick();
2486+
selectCDR = fixture.componentInstance.select;
2487+
expect(selectCDR).toBeUndefined();
24892488

2490-
const lastSelect = fixture.componentInstance.selectComponents.last as IgxSelectComponent;
2491-
expect(lastSelect).toBeDefined();
2492-
expect(lastSelect.value).toBe('CompanyName');
2493-
expect(console.warn).toHaveBeenCalledTimes(0);
2494-
}));
2489+
fixture.componentInstance.render = !fixture.componentInstance.render;
2490+
fixture.detectChanges();
2491+
selectCDR = fixture.componentInstance.select;
2492+
expect(selectCDR).toBeDefined();
2493+
expect(selectCDR.value).toBe('ID');
2494+
});
24952495
});
24962496

24972497
@Component({
@@ -2822,44 +2822,26 @@ class IgxSelectHeaderFooterComponent implements OnInit {
28222822

28232823
@Component({
28242824
template: `
2825-
<h4>*ngIf test select for 'expression changed...console Warning'</h4>
2826-
<div *ngIf="render">
2827-
<igx-select #select value="ID">
2828-
<label igxLabel>Column</label>
2829-
<igx-select-item *ngFor="let column of columns" [value]="column.field">
2830-
{{column.field}}
2831-
</igx-select-item>
2832-
</igx-select>
2833-
</div>
2834-
<button igxButton (click)="render=!render">toggle render *ngIF</button>
2835-
<div *ngIf="!render">
2836-
<igx-select #select value="CompanyName">
2837-
<label igxLabel>Column</label>
2838-
<igx-select-item *ngFor="let column of columns" [value]="column.field">
2839-
{{column.field}}
2840-
</igx-select-item>
2841-
</igx-select>
2842-
</div>
2843-
`
2825+
<h4>*ngIf test select for 'expression changed...console Warning'</h4>
2826+
<div *ngIf="render">
2827+
<igx-select #selectCDR value="ID">
2828+
<label igxLabel>Column</label>
2829+
<igx-select-item *ngFor="let column of columns" [value]="column.field">
2830+
{{column.field}}
2831+
</igx-select-item>
2832+
</igx-select>
2833+
</div>
2834+
`
28442835
})
28452836
class IgxSelectCDRComponent {
2846-
@ViewChildren(IgxSelectComponent) public selectComponents: QueryList<IgxSelectComponent>;
2837+
@ViewChild('selectCDR', { read: IgxSelectComponent, static: false })
2838+
public select: IgxSelectComponent;
28472839

28482840
public render = true;
28492841
public columns: Array<any> = [
2850-
{ field: 'ID', width: 80, resizable: true, movable: true, type: 'string' },
2851-
{ field: 'CompanyName', width: 150, resizable: true, movable: true, type: 'string' },
2852-
{ field: 'ContactName', width: 150, resizable: true, movable: true, type: 'string' },
2853-
{ field: 'Employees', width: 150, resizable: true, movable: true, type: 'number' },
2854-
{ field: 'ContactTitle', width: 150, resizable: true, movable: true, type: 'string' },
2855-
{ field: 'DateCreated', width: 150, resizable: true, movable: true, type: 'date' },
2856-
{ field: 'Address', width: 150, resizable: true, movable: true, type: 'string' },
2857-
{ field: 'City', width: 150, resizable: true, movable: true, type: 'string' },
2858-
{ field: 'Region', width: 150, resizable: true, movable: true, type: 'string' },
2859-
{ field: 'PostalCode', width: 150, resizable: true, movable: true, type: 'string' },
2860-
{ field: 'Phone', width: 150, resizable: true, movable: true, type: 'string' },
2861-
{ field: 'Fax', width: 150, resizable: true, movable: true, type: 'string' },
2862-
{ field: 'Contract', width: 150, resizable: true, movable: true, type: 'boolean' }
2842+
{ field: 'ID', type: 'string' },
2843+
{ field: 'CompanyName', type: 'string' },
2844+
{ field: 'ContactName', type: 'string' }
28632845
];
28642846
}
28652847
});

0 commit comments

Comments
 (0)