Skip to content

Commit 54ca42f

Browse files
authored
Merge branch 'master' into pbozhinov/fix-9073
2 parents b3995d5 + ef63481 commit 54ca42f

File tree

11 files changed

+203
-164
lines changed

11 files changed

+203
-164
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@
9595
"version": "11.1.0",
9696
"description": "Updates Ignite UI for Angular from v11.0.x to v11.1.0",
9797
"factory": "./update-11_1_0"
98+
},
99+
"migration-20": {
100+
"version": "12.0.0",
101+
"description": "Updates Ignite UI for Angular from v11.1.x to v12.0.0",
102+
"factory": "./update-12_0_0"
98103
}
99104
}
100105
}

projects/igniteui-angular/migrations/update-12_0_0/changes/theme-props.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,41 @@
11
{
22
"$schema": "../../common/schema/theme-props.schema.json",
33
"changes": [
4+
{
5+
"name": "$border-radius-round",
6+
"replaceWith": "$border-radius",
7+
"owner": "igx-avatar-theme"
8+
},
9+
{
10+
"name": "$border-radius-square",
11+
"replaceWith": "$border-radius",
12+
"owner": "igx-avatar-theme"
13+
},
14+
{
15+
"name": "$initials-background",
16+
"replaceWith": "$background",
17+
"owner": "igx-avatar-theme"
18+
},
19+
{
20+
"name": "$initials-color",
21+
"replaceWith": "$color",
22+
"owner": "igx-avatar-theme"
23+
},
24+
{
25+
"name": "$icon-background",
26+
"replaceWith": "$background",
27+
"owner": "igx-avatar-theme"
28+
},
29+
{
30+
"name": "$icon-color",
31+
"replaceWith": "$color",
32+
"owner": "igx-avatar-theme"
33+
},
34+
{
35+
"name": "$image-background",
36+
"replaceWith": "$background",
37+
"owner": "igx-avatar-theme"
38+
},
439
{
540
"name": "$flat-border-radius",
641
"replaceWith": "$border-radius",
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import * as path from 'path';
2+
3+
import { EmptyTree } from '@angular-devkit/schematics';
4+
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
5+
6+
describe('Update to 12.0.0', () => {
7+
let appTree: UnitTestTree;
8+
const runner = new SchematicTestRunner('ig-migrate', path.join(__dirname, '../migration-collection.json'));
9+
const configJson = {
10+
defaultProject: 'testProj',
11+
projects: {
12+
testProj: {
13+
sourceRoot: '/testSrc'
14+
}
15+
},
16+
schematics: {
17+
'@schematics/angular:component': {
18+
prefix: 'appPrefix'
19+
}
20+
}
21+
};
22+
23+
const migrationName = 'migration-20';
24+
25+
beforeEach(() => {
26+
appTree = new UnitTestTree(new EmptyTree());
27+
appTree.create('/angular.json', JSON.stringify(configJson));
28+
});
29+
30+
it('should update avatar theme args', async () => {
31+
appTree.create(
32+
`/testSrc/appPrefix/component/test.component.scss`,
33+
`
34+
$theme: igx-avatar-theme(
35+
$initials-background: white,
36+
$icon-background: green,
37+
$image-background: red,
38+
$initials-color: black,
39+
$icon-color: gold,
40+
$border-radius-round: 14px,
41+
$border-radius-square: 12px
42+
);
43+
`
44+
);
45+
46+
const tree = await runner
47+
.runSchematicAsync(migrationName, {}, appTree)
48+
.toPromise();
49+
50+
expect(
51+
tree.readContent('/testSrc/appPrefix/component/test.component.scss')
52+
).toEqual(
53+
`
54+
$theme: igx-avatar-theme(
55+
$background: white,
56+
$color: black,
57+
$border-radius: 14px
58+
);
59+
`
60+
);
61+
});
62+
});
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';
2+
import { UpdateChanges } from '../common/UpdateChanges';
3+
4+
const version = '12.0.0';
5+
6+
export default (): Rule => (host: Tree, context: SchematicContext) => {
7+
context.logger.info(`Applying migration for Ignite UI for Angular to version ${version}`);
8+
9+
const update = new UpdateChanges(__dirname, host, context);
10+
update.applyChanges();
11+
};

projects/igniteui-angular/src/lib/core/styles/base/utilities/_functions.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,16 +401,17 @@
401401
@function --var($map, $key, $fallback: null) {
402402
$igx-legacy-support: if(global-variable-exists('igx-legacy-support'), $igx-legacy-support, false);
403403
$css-var: str-slice(#{map-get($map, $key)}, 1, 3) == 'var';
404+
$name: map-get($map, 'name');
404405

405406
@if map-has-key($map, $key) {
406407
@if $igx-legacy-support == false {
407408
@if $css-var {
408409
@return map-get($map, $key);
409410
}
410411
@if not($fallback) {
411-
@return var(--#{map-get($map, 'name')}-#{$key})
412+
@return if($name, var(--#{map-get($map, 'name')}-#{$key}), var(--#{$key}));
412413
}
413-
@return var(--#{map-get($map, 'name')}-#{$key}, #{$fallback})
414+
@return if($name, var(--#{map-get($map, 'name')}-#{$key}, #{$fallback}), var(--#{$key}, #{$fallback}));
414415
} @else {
415416
@return map-get($map, $key);
416417
}

projects/igniteui-angular/src/lib/core/styles/components/avatar/_avatar-component.scss

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,10 @@
1313
@extend %igx-avatar-display !optional;
1414

1515
@include e(image) {
16-
@extend %igx-avatar-inner !optional;
1716
@extend %igx-avatar-image !optional;
1817
}
1918

2019
@include m(rounded) {
21-
@extend %igx-avatar-display !optional;
2220
@extend %igx-avatar--rounded !optional;
2321
}
2422

@@ -34,16 +32,7 @@
3432
@extend %igx-avatar--large !optional;
3533
}
3634

37-
@include m(image) {
38-
@extend %igx-avatar--image !optional;
39-
}
40-
41-
@include m(icon) {
42-
@extend %igx-avatar--icon !optional;
43-
}
44-
4535
@include m(initials) {
46-
@extend %igx-avatar--initials !optional;
4736
@extend %igx-avatar-initials--small !optional;
4837
}
4938

0 commit comments

Comments
 (0)