Skip to content

Commit 93fe5d1

Browse files
MKirovaMKirova
authored andcommitted
chore(*): Add migration for the removed onDataPreLoad event from igxTreeGrid.
1 parent e664ff0 commit 93fe5d1

File tree

4 files changed

+79
-0
lines changed

4 files changed

+79
-0
lines changed

projects/igniteui-angular/migrations/migration-collection.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@
7575
"version": "9.1.0",
7676
"description": "Updates Ignite UI for Angular from v9.0.x to v9.1.0",
7777
"factory": "./update-9_1_0"
78+
},
79+
"migration-16": {
80+
"version": "10.1.0",
81+
"description": "Updates Ignite UI for Angular from v9.1.x to v10.1.0",
82+
"factory": "./update-10_1_0"
7883
}
7984
}
8085
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"$schema": "../../common/schema/binding.schema.json",
3+
"changes": [
4+
{
5+
"name": "onDataPreLoad",
6+
"replaceWith": "onScroll",
7+
"owner": {
8+
"selector": "igx-tree-grid",
9+
"type": "component"
10+
}
11+
}
12+
]
13+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import * as path from 'path';
2+
3+
// tslint:disable:no-implicit-dependencies
4+
import { virtualFs } from '@angular-devkit/core';
5+
import { EmptyTree } from '@angular-devkit/schematics';
6+
// tslint:disable-next-line:no-submodule-imports
7+
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
8+
9+
describe('Update 10.1.0', () => {
10+
let appTree: UnitTestTree;
11+
const schematicRunner = new SchematicTestRunner('ig-migrate', path.join(__dirname, '../migration-collection.json'));
12+
const configJson = {
13+
defaultProject: 'testProj',
14+
projects: {
15+
testProj: {
16+
sourceRoot: '/testSrc'
17+
}
18+
},
19+
schematics: {
20+
'@schematics/angular:component': {
21+
prefix: 'appPrefix'
22+
}
23+
}
24+
};
25+
26+
beforeEach(() => {
27+
appTree = new UnitTestTree(new EmptyTree());
28+
appTree.create('/angular.json', JSON.stringify(configJson));
29+
});
30+
31+
it('should replace onDataPreLoad with onScroll ', async () => {
32+
appTree.create(
33+
`/testSrc/appPrefix/component/tree-grid.component.html`,
34+
'<igx-tree-grid (onDataPreLoad)="handleEvent($event)"></igx-tree-grid>'
35+
);
36+
37+
const tree = await schematicRunner.runSchematicAsync('migration-16', {}, appTree)
38+
.toPromise();
39+
40+
expect(tree.readContent('/testSrc/appPrefix/component/tree-grid.component.html'))
41+
.toEqual('<igx-tree-grid (onScroll)="handleEvent($event)"></igx-tree-grid>');
42+
43+
});
44+
});
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import {
2+
Rule,
3+
SchematicContext,
4+
Tree
5+
} from '@angular-devkit/schematics';
6+
import { UpdateChanges, InputPropertyType, BoundPropertyObject } from '../common/UpdateChanges';
7+
8+
const version = '10.1.0';
9+
10+
export default function (): Rule {
11+
return (host: Tree, context: SchematicContext) => {
12+
context.logger.info(`Applying migration for Ignite UI for Angular to version ${version}`);
13+
14+
const update = new UpdateChanges(__dirname, host, context);
15+
update.applyChanges();
16+
};
17+
}

0 commit comments

Comments
 (0)