mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
AAE-43331 Expand adf-icon (#11744)
* AAE-43331 Expand adf-icon * AAE-43331 Fix css
This commit is contained in:
@@ -84,5 +84,14 @@ describe('IconDirective', () => {
|
|||||||
expect(await iconHarness.getType()).toBe(IconType.SVG);
|
expect(await iconHarness.getType()).toBe(IconType.SVG);
|
||||||
expect(await iconHarness.getName()).toContain('mock_alias');
|
expect(await iconHarness.getName()).toContain('mock_alias');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should set svg icon if alias map is provided and name matches an alias value directly', async () => {
|
||||||
|
component.name = 'mock_alias';
|
||||||
|
|
||||||
|
const iconHarness = await loader.getHarness(MatIconHarness);
|
||||||
|
|
||||||
|
expect(await iconHarness.getType()).toBe(IconType.SVG);
|
||||||
|
expect(await iconHarness.getName()).toContain('mock_alias');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export class IconDirective implements OnChanges {
|
|||||||
@Input('adf-icon') name: string;
|
@Input('adf-icon') name: string;
|
||||||
|
|
||||||
ngOnChanges() {
|
ngOnChanges() {
|
||||||
const iconAlias = this.aliasMap?.[this.name];
|
const iconAlias = this.getIconAlias();
|
||||||
|
|
||||||
iconAlias ? this.setSvgIcon(iconAlias) : this.appendLigatureText();
|
iconAlias ? this.setSvgIcon(iconAlias) : this.appendLigatureText();
|
||||||
}
|
}
|
||||||
@@ -60,4 +60,12 @@ export class IconDirective implements OnChanges {
|
|||||||
private resetSvgIcon() {
|
private resetSvgIcon() {
|
||||||
this.matIcon.svgIcon = null;
|
this.matIcon.svgIcon = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private getIconAlias(): string | undefined {
|
||||||
|
if (!this.aliasMap) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.aliasMap[this.name] ?? (Object.values(this.aliasMap).includes(this.name) ? this.name : undefined);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,9 +8,6 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
&__icon > *:first-child {
|
&__icon > *:first-child {
|
||||||
font-size: var(--theme-display-3-font-size);
|
|
||||||
height: var(--theme-display-3-font-size);
|
|
||||||
width: var(--theme-display-3-font-size);
|
|
||||||
opacity: 0.6;
|
opacity: 0.6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user