Skip to content

Commit

Permalink
Adding migrations for rowData and rowID (#10524)
Browse files Browse the repository at this point in the history
* chore(*): add migrations for rowData/rowID

* chore(*): remove duplicated export

Co-authored-by: dobromirts <[email protected]>
  • Loading branch information
hanastasov and dobromirts authored Nov 17, 2021
1 parent 498a3c5 commit 45ac198
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 8 deletions.
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

0 comments on commit 45ac198

Please sign in to comment.