From 021e471e269beeaac20b28935de4d1c2bba04ce5 Mon Sep 17 00:00:00 2001 From: "Bajohr, Rayk" Date: Fri, 26 Jun 2026 16:14:37 +0200 Subject: [PATCH] =?UTF-8?q?refactor(icon):=20remove=20`disableSvgIcons`=20?= =?UTF-8?q?from=20=C2=B4provideIconConfig()`=20options?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes #1510 BREAKING CHANGE: removed `disableSvgIcons` from ´provideIconConfig()` configuration Consumer which want to provide their own custom icons must call `addIcons` during application bootstrap. --- api-goldens/element-ng/icon/index.api.md | 1 - .../element-ng/icon/si-icon.component.spec.ts | 23 +------------------ projects/element-ng/icon/si-icon.component.ts | 15 ++++-------- 3 files changed, 5 insertions(+), 34 deletions(-) diff --git a/api-goldens/element-ng/icon/index.api.md b/api-goldens/element-ng/icon/index.api.md index 510946514c..c6f01dad97 100644 --- a/api-goldens/element-ng/icon/index.api.md +++ b/api-goldens/element-ng/icon/index.api.md @@ -20,7 +20,6 @@ export const elementCheckedImageShape = "data:image/svg+xml;base64,PHN2ZyBpZD0iS // @public export interface IconConfig { - disableSvgIcons?: boolean; } // @public diff --git a/projects/element-ng/icon/si-icon.component.spec.ts b/projects/element-ng/icon/si-icon.component.spec.ts index 631074acd4..ebde33ae0b 100644 --- a/projects/element-ng/icon/si-icon.component.spec.ts +++ b/projects/element-ng/icon/si-icon.component.spec.ts @@ -7,7 +7,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { SiThemeService } from '@siemens/element-ng/theme'; -import { provideIconConfig, SiIconComponent } from './si-icon.component'; +import { SiIconComponent } from './si-icon.component'; import { addIcons, IconService } from './si-icons'; // It seems like the debug element is not able to query the SVGs. @@ -41,9 +41,6 @@ describe('SiSvgIconComponent', () => { describe('with enabled svg icons', () => { beforeEach(async () => { - TestBed.configureTestingModule({ - providers: [provideIconConfig({ disableSvgIcons: false })] - }); fixture = TestBed.createComponent(TestHostComponent); component = fixture.componentInstance; fixture.detectChanges(); @@ -109,24 +106,6 @@ describe('SiSvgIconComponent', () => { }); }); }); - - describe('with disabled svg icons', () => { - beforeEach(() => { - TestBed.configureTestingModule({ - providers: [provideIconConfig({ disableSvgIcons: true })] - }); - fixture = TestBed.createComponent(TestHostComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should always use the icon-font', () => { - component.icon.set('element-svg'); - fixture.detectChanges(); - expect(getIconHostStyle()).toBe(''); - expect(fixture.debugElement.query(By.css('.element-svg'))).toBeTruthy(); - }); - }); }); describe('with multiple instances', () => { diff --git a/projects/element-ng/icon/si-icon.component.ts b/projects/element-ng/icon/si-icon.component.ts index f481c9fc70..8b2317f305 100644 --- a/projects/element-ng/icon/si-icon.component.ts +++ b/projects/element-ng/icon/si-icon.component.ts @@ -17,18 +17,12 @@ import { IconService } from './si-icons'; /** * Global configuration for icons. */ -export interface IconConfig { - /** - * If true, the si-icon component will always render the icon font instead of the svg. - * - * @defaultValue false - */ - disableSvgIcons?: boolean; -} +// eslint-disable-next-line @typescript-eslint/no-empty-object-type +export interface IconConfig {} const ICON_CONFIG = new InjectionToken('ICON_CONFIG', { providedIn: 'root', - factory: () => ({ disableSvgIcons: false }) + factory: () => ({}) }); /** @@ -82,11 +76,10 @@ export class SiIconComponent { */ readonly icon = input.required(); - private readonly config = inject(ICON_CONFIG); private readonly iconService = inject(IconService); protected readonly svgIcon = computed(() => { - const icon = this.config.disableSvgIcons ? undefined : this.iconService.getIcon(this.icon()); + const icon = this.iconService.getIcon(this.icon()); if (!icon) { return undefined; }