Skip to content

Commit f7d780b

Browse files
author
MPopov
committed
fix(Grid toolbar): Fix migrations
Signed-off-by: MPopov <[email protected]>
1 parent 64461a2 commit f7d780b

File tree

5 files changed

+125
-38
lines changed

5 files changed

+125
-38
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@
5757
"factory": "./update-8_2_3"
5858
},
5959
"migration-12": {
60+
"version": "8.2.6",
61+
"description": "Updates Ignite UI for Angular from v8.2.3 to v8.2.6",
62+
"factory": "./update-8_2_6"
63+
},
64+
"migration-13": {
6065
"version": "9.0.0",
6166
"description": "Updates Ignite UI for Angular from v8.2.x to v9.2.0",
6267
"factory": "./update-9_0_0"
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"$schema": "../../common/schema/theme-props.schema.json",
3+
"changes": [
4+
{
5+
"name": "$button-background",
6+
"remove": true,
7+
"owner": "igx-grid-toolbar-theme"
8+
},
9+
{
10+
"name": "$button-text-color",
11+
"remove": true,
12+
"owner": "igx-grid-toolbar-theme"
13+
},
14+
{
15+
"name": "$button-hover-background",
16+
"remove": true,
17+
"owner": "igx-grid-toolbar-theme"
18+
},
19+
{
20+
"name": "$button-hover-text-color",
21+
"remove": true,
22+
"owner": "igx-grid-toolbar-theme"
23+
},
24+
{
25+
"name": "$button-focus-background",
26+
"remove": true,
27+
"owner": "igx-grid-toolbar-theme"
28+
},
29+
{
30+
"name": "$button-focus-text-color",
31+
"remove": true,
32+
"owner": "igx-grid-toolbar-theme"
33+
}
34+
]
35+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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 8.2.6', () => {
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 update igx-carousel-theme prop', done => {
32+
appTree.create(
33+
'/testSrc/appPrefix/component/test.component.scss',
34+
`$my-toolbar-theme: igx-grid-toolbar-theme(
35+
$background-color: null,
36+
$button-background: null,
37+
$title-text-color: null,
38+
$button-text-color: null,
39+
$button-hover-background: null,
40+
$button-hover-text-color: null,
41+
$button-focus-background: null,
42+
$button-focus-text-color: null,
43+
$dropdown-background: null,
44+
$item-text-color: null,
45+
$item-hover-background: null,
46+
$item-hover-text-color: null,
47+
$item-focus-background: null,
48+
$item-focus-text-color: null
49+
);`
50+
);
51+
const tree = schematicRunner.runSchematic('migration-12', {}, appTree);
52+
expect(tree.readContent('/testSrc/appPrefix/component/test.component.scss'))
53+
.toEqual(
54+
`$my-toolbar-theme: igx-grid-toolbar-theme(
55+
$background-color: null,
56+
$title-text-color: null,
57+
$dropdown-background: null,
58+
$item-text-color: null,
59+
$item-hover-background: null,
60+
$item-hover-text-color: null,
61+
$item-focus-background: null,
62+
$item-focus-text-color: null
63+
);`
64+
);
65+
done();
66+
});
67+
});
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 } from '../common/UpdateChanges';
7+
8+
const version = '8.2.6';
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+
}

projects/igniteui-angular/migrations/update-9_0_0/index.spec.ts

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -35,49 +35,12 @@ describe('Update 9.0.0', () => {
3535
IgxRowComponent, IgxHierarchicalGridBaseComponent } from 'igniteui-angular';
3636
`);
3737

38-
const tree = schematicRunner.runSchematic('migration-12', {}, appTree);
38+
const tree = schematicRunner.runSchematic('migration-13', {}, appTree);
3939
expect(tree.readContent('/testSrc/appPrefix/component/test.component.ts'))
4040
.toEqual(
4141
`import { IgxDropDownBaseDirective, IgxDropDownItemBaseDirective, IgxGridBaseDirective,
4242
IgxRowDirective, IgxHierarchicalGridBaseDirective } from 'igniteui-angular';
4343
`);
4444
done();
4545
});
46-
47-
it('should update igx-carousel-theme prop', done => {
48-
appTree.create(
49-
'/testSrc/appPrefix/component/test.component.scss',
50-
`$my-toolbar-theme: igx-grid-toolbar-theme(
51-
$background-color: null,
52-
$button-background: null,
53-
$title-text-color: null,
54-
$button-text-color: null,
55-
$button-hover-background: null,
56-
$button-hover-text-color: null,
57-
$button-focus-background: null,
58-
$button-focus-text-color: null,
59-
$dropdown-background: null,
60-
$item-text-color: null,
61-
$item-hover-background: null,
62-
$item-hover-text-color: null,
63-
$item-focus-background: null,
64-
$item-focus-text-color: null
65-
);`
66-
);
67-
const tree = schematicRunner.runSchematic('migration-12', {}, appTree);
68-
expect(tree.readContent('/testSrc/appPrefix/component/test.component.scss'))
69-
.toEqual(
70-
`$my-toolbar-theme: igx-grid-toolbar-theme(
71-
$background-color: null,
72-
$title-text-color: null,
73-
$dropdown-background: null,
74-
$item-text-color: null,
75-
$item-hover-background: null,
76-
$item-hover-text-color: null,
77-
$item-focus-background: null,
78-
$item-focus-text-color: null
79-
);`
80-
);
81-
done();
82-
});
8346
});

0 commit comments

Comments
 (0)