Skip to content

test(*): apply control flow suggestions #15417

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ describe('igxGridEditingActions #grid ', () => {
template: `
<igx-grid #grid [data]="data" [width]="'800px'" [height]="'500px'"
[rowEditable]="true" [primaryKey]="'ID'">
@for (c of columns; track c) {
@for (c of columns; track c.field) {
<igx-column [sortable]="true" [field]="c.field" [header]="c.field"
[width]="c.width" [pinned]='c.pinned' [hidden]='c.hidden'>
</igx-column>
Expand Down Expand Up @@ -469,7 +469,7 @@ class IgxActionStripTestingComponent implements OnInit {
template: `
<igx-grid #grid [data]="data" [width]="'800px'" [height]="'500px'"
[rowEditable]="true" [primaryKey]="'ID'">
@for (c of columns; track c) {
@for (c of columns; track c.field) {
<igx-column [sortable]="true" [field]="c.field" [header]="c.field"
[width]="c.width" [pinned]='c.pinned' [hidden]='c.hidden'>
</igx-column>
Expand All @@ -491,7 +491,7 @@ class IgxActionStripPinEditComponent extends IgxActionStripTestingComponent {
template: `
<igx-grid #grid [data]="data" [width]="'800px'" [height]="'500px'"
[rowEditable]="true" [primaryKey]="'ID'">
@for (c of columns; track c) {
@for (c of columns; track c.field) {
<igx-column [sortable]="true" [field]="c.field" [header]="c.field"
[width]="c.width" [pinned]='c.pinned' [hidden]='c.hidden'>
</igx-column>
Expand All @@ -512,7 +512,7 @@ class IgxActionStripEditMenuComponent extends IgxActionStripTestingComponent {
template: `
<igx-grid #grid [data]="dataOneRow" [width]="'800px'" [height]="'500px'"
[rowEditable]="true" [primaryKey]="'ID'">
@for (c of columns; track c) {
@for (c of columns; track c.field) {
<igx-column [sortable]="true" [field]="c.field" [header]="c.field"
[width]="c.width" [pinned]='c.pinned' [hidden]='c.hidden'>
</igx-column>
Expand All @@ -534,7 +534,7 @@ class IgxActionStripOneRowComponent extends IgxActionStripTestingComponent {
template: `
<igx-grid #grid [data]="dataOneRow" [width]="'800px'" [height]="'500px'"
[rowEditable]="true" [primaryKey]="'ID'">
@for (c of columns; track c) {
@for (c of columns; track c.field) {
<igx-column [sortable]="true" [field]="c.field" [header]="c.field"
[width]="c.width" [pinned]='c.pinned' [hidden]='c.hidden'>
</igx-column>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ describe('igxGridPinningActions #grid ', () => {
template: `
<igx-grid #grid [data]="data" [width]="'800px'" [height]="'500px'"
[rowEditable]="true" [primaryKey]="'ID'">
@for (c of columns; track c) {
@for (c of columns; track c.field) {
<igx-column [sortable]="true" [field]="c.field" [header]="c.field"
[width]="c.width" [pinned]='c.pinned' [hidden]='c.hidden'>
</igx-column>
Expand Down Expand Up @@ -176,7 +176,7 @@ class IgxActionStripTestingComponent implements OnInit {
template: `
<igx-grid #grid [data]="data" [width]="'800px'" [height]="'500px'"
[rowEditable]="true" [primaryKey]="'ID'">
@for (c of columns; track c) {
@for (c of columns; track c.field) {
<igx-column [sortable]="true" [field]="c.field" [header]="c.field"
[width]="c.width" [pinned]='c.pinned' [hidden]='c.hidden'>
</igx-column>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ class ButtonGroupWithSelectedButtonComponent {
@Component({
template: `
<igx-buttongroup>
@for (item of items; track item) {
@for (item of items; track item.key) {
<button igxButton [selected]="item.key === selectedValue">{{item.value}}</button>
}
</igx-buttongroup>
Expand Down
4 changes: 2 additions & 2 deletions projects/igniteui-angular/src/lib/chips/chip.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { getComponentSize } from '../core/utils';
@Component({
template: `
<igx-chips-area #chipsArea>
@for (chip of chipList; track chip) {
@for (chip of chipList; track chip.id) {
<igx-chip #chipElem class="custom"
[id]="chip.id" [draggable]="chip.draggable"
[removable]="chip.removable" [selectable]="chip.selectable"
Expand Down Expand Up @@ -69,7 +69,7 @@ class TestChipComponent {
@Component({
template: `
<igx-chips-area>
@for (chip of chipList; track chip) {
@for (chip of chipList; track chip.id) {
<igx-chip>
<span igxLabel>label</span>
<span igxSuffix>suf</span>
Expand Down
4 changes: 2 additions & 2 deletions projects/igniteui-angular/src/lib/chips/chips-area.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { IgxPrefixDirective } from './public_api';
@Component({
template: `
<igx-chips-area #chipsArea class="customClass">
@for (chip of chipList; track chip) {
@for (chip of chipList; track chip.id) {
<igx-chip #chipElem
[id]="chip.id" [draggable]="chip.draggable" [removable]="chip.removable" [selectable]="chip.selectable">
<igx-icon igxPrefix>drag_indicator</igx-icon>
Expand Down Expand Up @@ -59,7 +59,7 @@ class TestChipSelectComponent extends TestChipComponent {
@Component({
template: `
<igx-chips-area #chipsArea (reorder)="chipsOrderChanged($event)">
@for (chip of chipList; track chip) {
@for (chip of chipList; track chip.id) {
<igx-chip #chipElem [id]="chip.id" [draggable]="true"
[removable]="true" [selectable]="true" (remove)="chipRemoved($event)">
<igx-icon igxPrefix>drag_indicator</igx-icon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class DeclarativeListTestComponent {
@Component({
template: `
<igx-list>
@for (item of dataSourceItems | igxFilter: fo; track item) {
@for (item of dataSourceItems | igxFilter: fo; track item.key) {
<igx-list-item> {{item.text}} </igx-list-item>
}
</igx-list>`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1298,7 +1298,7 @@ describe('IgxDropDown ', () => {
<button (click)="toggleDropDown()">Toggle</button>
<igx-drop-down id="test-id" igxDropDownItemNavigation [maxHeight]="maxHeight"
[allowItemsFocus]="true" style="--ig-size: var(--ig-size-medium);">
@for (item of items; track item) {
@for (item of items; track item.field) {
<igx-drop-down-item [disabled]="item.disabled" [isHeader]="item.header" [selected]="item.selected">
{{item.field}}
</igx-drop-down-item>
Expand Down Expand Up @@ -1338,14 +1338,14 @@ class IgxDropDownTestComponent {
template: `
<button (click)="selectItem5()">Select 5</button>
<igx-drop-down #dropdown1>
@for (item of items; track item) {
@for (item of items; track item.field) {
<igx-drop-down-item>
{{ item.field }}
</igx-drop-down-item>
}
</igx-drop-down>
<igx-drop-down #dropdown2>
@for (item of items; track item) {
@for (item of items; track item.field) {
<igx-drop-down-item>
{{ item.field }}
</igx-drop-down-item>
Expand Down Expand Up @@ -1403,7 +1403,7 @@ class DoubleIgxDropDownComponent implements OnInit {
<igx-drop-down igxDropDownItemNavigation (selectionChanging)="selectionChanging($event)"
(opening)="onToggleOpening()" (opened)="onToggleOpened()"
(closing)="onToggleClosing()" (closed)="onToggleClosed()" [width]="'400px'" [height]="'400px'">
@for (item of items; track item) {
@for (item of items; track item.field) {
<igx-drop-down-item>
{{ item.field }}
</igx-drop-down-item>
Expand Down Expand Up @@ -1441,7 +1441,7 @@ class IgxDropDownAnchorTestComponent {
@Component({
template: ` <input #inputElement [igxDropDownItemNavigation]="dropdownElement" class='test-input' type='text' value='Focus Me!'/>
<igx-drop-down #dropdownElement [width]="'400px'" [height]="'400px'" [allowItemsFocus]="true">
@for (item of items; track item) {
@for (item of items; track item.field) {
<igx-drop-down-item>
{{ item.field }}
</igx-drop-down-item>
Expand All @@ -1466,9 +1466,9 @@ class InputWithDropDownDirectiveComponent {
@Component({
template: `
<igx-drop-down>
@for (parent of data; track parent) {
@for (parent of data; track parent.name) {
<igx-drop-down-item-group [label]="parent.name">
@for (child of parent.children; track child) {
@for (child of parent.children; track child.value) {
<igx-drop-down-item [value]="child.value">
{{ child.name }}
</igx-drop-down-item>
Expand Down
2 changes: 1 addition & 1 deletion projects/igniteui-angular/src/lib/grids/grid/cell.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ describe('IgxGrid - Cell component #grid', () => {
@Component({
template: `
<igx-grid #grid [data]="data" [primaryKey]="'ProductID'" [width]="'900px'" [height]="'500px'" rowSelection = "multiple" [moving]="true">
@for (c of columns; track c) {
@for (c of columns; track c.field) {
<igx-column [field]="c.field"
[header]="c.field"
[width]="c.width"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, ViewChild } from '@angular/core';
import { Component, ViewChild } from '@angular/core';
import { TestBed, ComponentFixture, fakeAsync, tick, waitForAsync } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
Expand Down Expand Up @@ -2622,9 +2622,9 @@ describe('IgxGrid Multi Row Layout - Keyboard navigation #grid', () => {
@Component({
template: `
<igx-grid #grid [data]="data" [height]="'500px'" (selected)="cellSelected($event)">
@for (group of colGroups; track group) {
@for (group of colGroups; track group.group) {
<igx-column-layout [hidden]='group.hidden' [pinned]='group.pinned' [field]='group.group'>
@for (col of group.columns; track col) {
@for (col of group.columns; track col.field) {
<igx-column
[rowStart]="col.rowStart" [colStart]="col.colStart" [width]='col.width'
[colEnd]="col.colEnd" [rowEnd]="col.rowEnd" [field]='col.field' [editable]='col.editable'></igx-column>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1436,9 +1436,9 @@ export class GridRowPinningComponent {
template: `
<igx-grid [data]="data" height="500px" [pinning]='pinningConfig' [rowSelection]="'single'"
[rowEditable]="true">
@for (group of colGroups; track group) {
@for (group of colGroups; track group.group) {
<igx-column-layout>
@for (col of group.columns; track col) {
@for (col of group.columns; track col.field) {
<igx-column
[rowStart]="col.rowStart" [colStart]="col.colStart" [width]='col.width'
[colEnd]="col.colEnd" [rowEnd]="col.rowEnd" [field]='col.field'></igx-column>
Expand Down
20 changes: 10 additions & 10 deletions projects/igniteui-angular/src/lib/grids/grid/grid.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2928,7 +2928,7 @@ describe('IgxGrid Component Tests #grid', () => {
@Component({
template: `<div style="width: 800px; height: 600px;">
<igx-grid #grid [data]="data" [autoGenerate]="autoGenerate" [autoGenerateExclude]="autoGenerateExclude" (columnInit)="columnCreated($event)">
@for (column of columns; track column) {
@for (column of columns; track column.field) {
<igx-column [field]="column.field" [hasSummary]="column.hasSummary"
[header]="column.field" [width]="column.width">
</igx-column>
Expand Down Expand Up @@ -3004,7 +3004,7 @@ export class IgxGridTestComponent {

@Component({
template: `<igx-grid #grid [data]="data" (columnInit)="initColumns($event)">
@for (col of columns; track col) {
@for (col of columns; track col.key) {
<igx-column [field]="col.key" [header]="col.key" [dataType]="col.dataType">
</igx-column>
}
Expand Down Expand Up @@ -3132,7 +3132,7 @@ export class IgxGridColumnHeaderInGroupAutoSizeComponent {

@Component({
template: `<igx-grid #grid [data]="data" [width]="'500px'" (columnInit)="initColumns($event)">
@for (col of columns; track col) {
@for (col of columns; track col.key) {
<igx-column [field]="col.key" [header]="col.key" [dataType]="col.dataType">
</igx-column>
}
Expand All @@ -3149,7 +3149,7 @@ export class IgxGridColumnPercentageWidthComponent extends IgxGridDefaultRenderi

@Component({
template: `<igx-grid #grid [hidden]="hidden" [data]="data" [autoGenerate]="false">
@for (col of columns; track col) {
@for (col of columns; track col.key) {
<igx-column [width]="'10%'" [field]="col.key" [header]="col.key" [dataType]="col.dataType">
</igx-column>
}
Expand Down Expand Up @@ -3430,7 +3430,7 @@ export class IgxGridFormattingComponent extends BasicGridComponent {
</igx-tab-header>
<igx-tab-content>
<igx-grid #grid2 [data]="data" [primaryKey]="'id'" [width]="'500px'" [height]="'300px'">
@for (column of columns; track column) {
@for (column of columns; track column.field) {
<igx-column
[field]="column.field"
[header]="column.field"
Expand All @@ -3446,7 +3446,7 @@ export class IgxGridFormattingComponent extends BasicGridComponent {
</igx-tab-header>
<igx-tab-content>
<igx-grid #grid3 [data]="data" [primaryKey]="'id'">
@for (column of columns; track column) {
@for (column of columns; track column.field) {
<igx-column
[field]="column.field"
[header]="column.field"
Expand All @@ -3463,7 +3463,7 @@ export class IgxGridFormattingComponent extends BasicGridComponent {
</igx-tab-header>
<igx-tab-content>
<igx-grid #grid4 [data]="data" [primaryKey]="'id'" [width]="'500px'" [height]="'300px'">
@for (column of columns; track column) {
@for (column of columns; track column.field) {
<igx-column
[field]="column.field"
[header]="column.field"
Expand All @@ -3481,7 +3481,7 @@ export class IgxGridFormattingComponent extends BasicGridComponent {
</igx-tab-header>
<igx-tab-content>
<igx-grid #grid5 [data]="data" [primaryKey]="'id'" [width]="'500px'" [height]="'100%'">
@for (column of columns; track column) {
@for (column of columns; track column.field) {
<igx-column
[field]="column.field"
[header]="column.field"
Expand All @@ -3499,7 +3499,7 @@ export class IgxGridFormattingComponent extends BasicGridComponent {
<igx-tab-content>
<div style='height:300px;'>
<igx-grid #grid6 [data]="data" [primaryKey]="'id'" [width]="'500px'" [height]="'100%'">
@for (column of columns; track column) {
@for (column of columns; track column.field) {
<igx-column
[field]="column.field"
[header]="column.field"
Expand Down Expand Up @@ -3576,7 +3576,7 @@ export class IgxGridWithCustomPaginationTemplateComponent {
@Component({
template: `<igx-grid #grid [width]="'2000px'" [height]="'2000px'" [data]="data"
[autoGenerate]="autoGenerate" [style.--ig-size]="1" [groupingExpressions]="groupingExpressions">
@for (column of columns; track column) {
@for (column of columns; track column.field) {
<igx-column [field]="column.field" [header]="column.field" [width]="column.width"></igx-column>
}
</igx-grid>`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4123,7 +4123,7 @@ export class CustomTemplateGridComponent extends DataParent {
[width]='width'
[height]='height'
[data]="testData">
@for (c of columns; track c) {
@for (c of columns; track c.field) {
<igx-column [groupable]="true" [field]="c.field" [header]="c.header || c.field" [width]="c.width + 'px'">
</igx-column>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1257,7 +1257,7 @@ describe('IgxGrid Master Detail #grid', () => {
@Component({
template: `
<igx-grid [data]="data" [width]="width" [height]="height" [primaryKey]="'ID'" [allowFiltering]="true" [rowSelection]="rowSelectable">
@for (c of columns; track c) {
@for (c of columns; track c.field) {
<igx-column [field]="c.field" [width]="c.width">
</igx-column>
}
Expand Down Expand Up @@ -1309,7 +1309,7 @@ export class DefaultGridMasterDetailComponent {
template: `
<igx-grid [data]="data" [expansionStates]="expStates"
[width]="width" [height]="height" [primaryKey]="'ID'" [rowSelection]="rowSelectable">
@for (c of columns; track c) {
@for (c of columns; track c.field) {
<igx-column [field]="c.field" [header]="c.field" [width]="c.width">
</igx-column>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1232,9 +1232,9 @@ describe('IgxGrid - multi-row-layout Integration #grid - ', () => {
</igx-grid-toolbar-actions>
</igx-grid-toolbar>
}
@for (group of colGroups; track group) {
@for (group of colGroups; track group.group) {
<igx-column-layout [field]='group.group' [hidden]='group.hidden'>
@for (col of group.columns; track col) {
@for (col of group.columns; track col.field) {
<igx-column
[rowStart]="col.rowStart" [colStart]="col.colStart" [width]='col.width'
[colEnd]="col.colEnd" [rowEnd]="col.rowEnd" [field]='col.field'></igx-column>
Expand Down Expand Up @@ -1333,9 +1333,9 @@ export class ColumnLayoutPinningTestComponent {
@Component({
template: `
<igx-grid #grid [data]="data" height="500px" [allowFiltering]="true">
@for (group of colGroups; track group) {
@for (group of colGroups; track group.group) {
<igx-column-layout [field]='group.group' [pinned]='group.pinned'>
@for (col of group.columns; track col) {
@for (col of group.columns; track col.field) {
<igx-column
[rowStart]="col.rowStart" [colStart]="col.colStart" [width]='col.width'
[colEnd]="col.colEnd" [rowEnd]="col.rowEnd" [field]='col.field'></igx-column>
Expand All @@ -1352,9 +1352,9 @@ export class ColumnLayoutFilteringTestComponent extends ColumnLayoutPinningTestC
@Component({
template: `
<igx-grid #grid [data]="data" height="500px" [style.--ig-size]="1">
@for (group of colGroups; track group) {
@for (group of colGroups; track group.group) {
<igx-column-layout [field]='group.group' [pinned]='group.pinned'>
@for (col of group.columns; track col) {
@for (col of group.columns; track col.field) {
<igx-column
[rowStart]="col.rowStart" [colStart]="col.colStart" [width]='col.width'
[colEnd]="col.colEnd" [rowEnd]="col.rowEnd" [field]='col.field' [groupable]="col.groupable"></igx-column>
Expand Down Expand Up @@ -1398,7 +1398,7 @@ export class ColumnLayoutGroupingTestComponent extends ColumnLayoutPinningTestCo
<igx-grid #grid [data]="data" height="500px">
@for (group of colGroups; track group.group) {
<igx-column-layout>
@for (col of group.columns; track col) {
@for (col of group.columns; track col.field) {
<igx-column [field]='col.field' [width]='col.width' [resizable]='col.resizable'
[rowStart]="col.rowStart" [colStart]="col.colStart" [colEnd]="col.colEnd" [rowEnd]="col.rowEnd">
</igx-column>
Expand Down
Loading
Loading