Skip to content
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

Adding migrations for rowData and rowID #10524

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 @@ -41,6 +41,33 @@
"IgxHierarchicalGridComponent",
"IgxRowIslandComponent"
]
},
{
"member": "rowData",
"replaceWith": "data",
"definedIn": [
"IgxGridRowComponent",
"IgxTreeGridRowComponent",
"IgxHierarchicalGridRowComponent",
"IgxChildGridRowComponent",
"IgxGridRow",
"IgxTreeGridRow",
"IgxHierarchicalGridRow"
]
},
{
"member": "rowID",
"replaceWith": "key",
"definedIn": [
"IgxGridRowComponent",
"IgxTreeGridRowComponent",
"IgxHierarchicalGridRowComponent",
"IgxChildGridRowComponent",
"IgxGridRow",
"IgxTreeGridRow",
"IgxHierarchicalGridRow",
"IgxRowDirective"
]
}
]
}
64 changes: 64 additions & 0 deletions projects/igniteui-angular/migrations/update-13_0_0/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,68 @@ schemas: []
export class AppModule {}
`);
});

it('Should properly rename rowData property to data', async () => {
pending('set up tests for migrations through lang service');
appTree.create('/testSrc/appPrefix/component/test.component.ts',
`
import { IgxGridRow, IgxTreeGridRow, IgxHierarchicalGridRow, IgxChildGridRowComponent, IgxRowDirective } from 'igniteui-angular';
export class MyClass {
@ViewChild(IgxGridComponent, { read: IgxGridComponent })
public grid: IgxGridComponent;
public tgrid: IgxGridComponent;
public hgrid: IgxGridComponent;
public ngAfterViewInit() {
// rowData
const rowData = this.grid.getRowByIndex(0).rowData;
const rowData2 = this.tgrid.getRowByIndex(0).rowData;
const rowData3 = this.hgrid.getRowByIndex(0).rowData;
const rowData4 = this.grid.rowList.first.rowData;
const rowData5 = this.tgrid.rowList.first.rowData;
const rowData6 = this.hgrid.rowList.first.rowData;
// rowID
const rowID = this.grid.getRowByIndex(0).rowID;
const rowID2 = this.tgrid.getRowByIndex(0).rowID;
const rowID3 = this.hgrid.getRowByIndex(0).rowID;
const rowID4 = this.grid.rowList.first.rowID;
const rowID5 = this.tgrid.rowList.first.rowID;
const rowID6 = this.hgrid.rowList.first.rowID;
}
}
`);

const tree = await schematicRunner
.runSchematicAsync(migrationName, {}, appTree)
.toPromise();

expect(
tree.readContent('/testSrc/appPrefix/component/test.component.ts')
).toEqual(
`
import { IgxGridRow, IgxTreeGridRow, IgxHierarchicalGridRow, IgxChildGridRowComponent, IgxRowDirective } from 'igniteui-angular';
export class MyClass {
@ViewChild(IgxGridComponent, { read: IgxGridComponent })
public grid: IgxGridComponent;
public tgrid: IgxGridComponent;
public hgrid: IgxGridComponent;
public ngAfterViewInit() {
// rowData
const rowData = this.grid.getRowByIndex(0).data;
const rowData2 = this.tgrid.getRowByIndex(0).data;
const rowData3 = this.hgrid.getRowByIndex(0).data;
const rowData4 = this.grid.rowList.first.data;
const rowData5 = this.tgrid.rowList.first.data;
const rowData6 = this.hgrid.rowList.first.data;
// rowID
const rowID = this.grid.getRowByIndex(0).key;
const rowID2 = this.tgrid.getRowByIndex(0).key;
const rowID3 = this.hgrid.getRowByIndex(0).key;
const rowID4 = this.grid.rowList.first.key;
const rowID5 = this.tgrid.rowList.first.key;
const rowID6 = this.hgrid.rowList.first.key;
}
}
`
);
});
});
14 changes: 6 additions & 8 deletions projects/igniteui-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,6 @@
"uuid": "^8.3.0",
"@igniteui/material-icons-extended": "^2.10.0"
},
"exports": {
"./schematics/*": {
"default": "./schematics/*"
},
"./migrations/*": {
"default": "./migrations/*"
}
},
"peerDependencies": {
"@angular/common": "^13.0.0",
"@angular/core": "^13.0.0",
Expand All @@ -102,6 +94,12 @@
},
"schematics": "./schematics/collection.json",
"exports": {
"./schematics/*": {
"default": "./schematics/*"
},
"./migrations/*": {
"default": "./migrations/*"
},
"./lib/core/styles/themes/index": {
"sass": "./lib/core/styles/themes/_index.scss"
},
Expand Down