diff --git a/projects/igniteui-angular/src/lib/carousel/carousel.component.spec.ts b/projects/igniteui-angular/src/lib/carousel/carousel.component.spec.ts index c2170bb4a41..6f28b6791ec 100644 --- a/projects/igniteui-angular/src/lib/carousel/carousel.component.spec.ts +++ b/projects/igniteui-angular/src/lib/carousel/carousel.component.spec.ts @@ -1224,7 +1224,7 @@ class CarouselTemplateSetInTypescriptTestComponent { @Component({ template: ` - @for (slide of slides; track slide) { + @for (slide of slides; track slide.text) {

{{slide.text}}

@@ -1240,10 +1240,6 @@ class CarouselDynamicSlidesComponent { public slides = []; constructor() { - this.addNewSlide(); - } - - public addNewSlide() { this.slides.push( { text: 'Slide 1', active: false }, { text: 'Slide 2', active: false }, diff --git a/projects/igniteui-angular/src/lib/directives/drag-drop/drag-drop.spec.ts b/projects/igniteui-angular/src/lib/directives/drag-drop/drag-drop.spec.ts index de893b9bd94..525fec4c950 100644 --- a/projects/igniteui-angular/src/lib/directives/drag-drop/drag-drop.spec.ts +++ b/projects/igniteui-angular/src/lib/directives/drag-drop/drag-drop.spec.ts @@ -2107,13 +2107,13 @@ class TestDragDropStrategiesComponent extends TestDragDropLinkedSingleComponent drag_indicator Movies list - @for (category of categoriesNotes; track category) { + @for (category of categoriesNotes; track category.text) {
drag_indicator {{category.text}}
- @for (note of getCategoryMovies(category.text); track note) { + @for (note of getCategoryMovies(category.text); track note.text) {
drag_indicator @@ -2128,11 +2128,11 @@ class TestDragDropStrategiesComponent extends TestDragDropLinkedSingleComponent imports: [IgxIconComponent, IgxDragDirective, IgxDragHandleDirective] }) class TestDragDropNestedComponent extends TestDragDropComponent { - public categoriesNotes = [ + protected categoriesNotes = [ { text: 'Action', dragged: false }, { text: 'Fantasy', dragged: false } ]; - public listNotes = [ + protected listNotes = [ { text: 'Avengers: Endgame', category: 'Action', dragged: false }, { text: 'Avatar', category: 'Fantasy', dragged: false }, { text: 'Titanic', category: 'Drama', dragged: false }, @@ -2142,7 +2142,7 @@ class TestDragDropNestedComponent extends TestDragDropComponent { { text: 'The Avengers', category: 'Action', dragged: false } ]; - public getCategoryMovies(inCategory: string){ + protected getCategoryMovies(inCategory: string){ return this.listNotes.filter(item => item.category === inCategory); } } diff --git a/projects/igniteui-angular/src/lib/select/select.component.spec.ts b/projects/igniteui-angular/src/lib/select/select.component.spec.ts index 1e9bfb22c5c..9b5c517e8d7 100644 --- a/projects/igniteui-angular/src/lib/select/select.component.spec.ts +++ b/projects/igniteui-angular/src/lib/select/select.component.spec.ts @@ -3053,7 +3053,7 @@ class IgxSelectTemplateFormComponent { alarm None - @for (item of items; track item) { + @for (item of items; track item.field) { {{ item.field }} diff --git a/projects/igniteui-angular/src/lib/tabs/tabs/tabs.component.spec.ts b/projects/igniteui-angular/src/lib/tabs/tabs/tabs.component.spec.ts index ac5821ddf74..acefcbf1c44 100644 --- a/projects/igniteui-angular/src/lib/tabs/tabs/tabs.component.spec.ts +++ b/projects/igniteui-angular/src/lib/tabs/tabs/tabs.component.spec.ts @@ -493,7 +493,7 @@ describe('IgxTabs', () => { expect(tabs.items.length).toBe(2); expect(tabs.selectedIndex).toBe(0); - fixture.componentInstance.addTab(3); + fixture.componentInstance.addTab(); fixture.detectChanges(); tick(100); diff --git a/projects/igniteui-angular/src/lib/test-utils/tabs-components.spec.ts b/projects/igniteui-angular/src/lib/test-utils/tabs-components.spec.ts index 6d548ca2f86..6e3ed047f34 100644 --- a/projects/igniteui-angular/src/lib/test-utils/tabs-components.spec.ts +++ b/projects/igniteui-angular/src/lib/test-utils/tabs-components.spec.ts @@ -98,7 +98,7 @@ export class TabsTestComponent { template: `
- @for (tab of collection; track tab) { + @for (tab of collection; track trackByItemRef(tab)) { {{ tab.name }} @@ -112,7 +112,7 @@ export class TabsTestComponent { export class TabsTest2Component { @ViewChild(IgxTabsComponent, { static: true }) public tabs: IgxTabsComponent; @ViewChild('wrapperDiv', { static: true }) public wrapperDiv: any; - public collection: any[]; + protected collection: any[]; constructor() { this.resetCollectionThreeTabs(); @@ -151,6 +151,9 @@ export class TabsTest2Component { public resetToEmptyCollection() { this.collection = []; } + + /** Explicitly track object so collection changes entirely for index logic test */ + protected trackByItemRef = (x: any) => x; } @Component({ @@ -198,7 +201,7 @@ export class TemplatedTabsTestComponent { template: `
- @for (tab of collection; track tab) { + @for (tab of collection; track tab.name) { {{ tab.name }} @@ -210,7 +213,7 @@ export class TemplatedTabsTestComponent { }) export class TabsTestSelectedTabComponent { @ViewChild(IgxTabsComponent, { static: true }) public tabs: IgxTabsComponent; - public collection: any[]; + protected collection: any[]; constructor() { this.collection = @@ -525,7 +528,7 @@ export class TabsWithPrefixSuffixTestComponent extends TabsTestComponent { template: `
- @for (contact of contacts; track contact) { + @for (contact of contacts; track contact.Name) { {{contact.Name}} @@ -547,7 +550,7 @@ export class TabsContactsComponent extends TabsTestComponent { template: `
- @for (tab of collection; track tab) { + @for (tab of collection; track tab.name) { {{ tab.name }} @@ -560,7 +563,7 @@ export class TabsContactsComponent extends TabsTestComponent { }) export class AddingSelectedTabComponent { @ViewChild(IgxTabsComponent, { static: true }) public tabs: IgxTabsComponent; - public collection: any[]; + protected collection: any[]; constructor() { this.collection = [ { name: 'tab1', selected: true }, @@ -568,9 +571,9 @@ export class AddingSelectedTabComponent { ]; } - public addTab(num: number) { + public addTab() { this.collection.forEach(t => t.selected = false); - this.collection.push({ name: 'tab' + num, selected: true }); + this.collection.push({ name: 'tab' + (this.collection.length + 1), selected: true }); } } @@ -578,7 +581,7 @@ export class AddingSelectedTabComponent { template: `
- @for (tab of collection; track tab) { + @for (tab of collection; track tab.name) { {{ tab.name }} @@ -592,18 +595,15 @@ export class AddingSelectedTabComponent { export class TabsRtlComponent { @ViewChild(IgxTabsComponent, { static: true }) public tabs: IgxTabsComponent; @ViewChild('wrapperDiv', { static: true }) public wrapperDiv: any; - public collection: any[]; - constructor() { - this.collection = [ - { name: 'tab1', selected: true }, - { name: 'tab2', selected: false }, - { name: 'tab3', selected: false }, - { name: 'tab4', selected: false }, - { name: 'tab5', selected: false }, - { name: 'tab6', selected: false }, - { name: 'tab7', selected: false }, - { name: 'tab8', selected: false }, - { name: 'tab9', selected: false }, - ]; - } + protected collection = [ + { name: 'tab1', selected: true }, + { name: 'tab2', selected: false }, + { name: 'tab3', selected: false }, + { name: 'tab4', selected: false }, + { name: 'tab5', selected: false }, + { name: 'tab6', selected: false }, + { name: 'tab7', selected: false }, + { name: 'tab8', selected: false }, + { name: 'tab9', selected: false }, + ]; }