diff --git a/projects/cdk/schematics/ng-update/v4/migrate-icons/rename-icons.ts b/projects/cdk/schematics/ng-update/v4/migrate-icons/rename-icons.ts index 2b5e87742463..9ebce913f3f4 100644 --- a/projects/cdk/schematics/ng-update/v4/migrate-icons/rename-icons.ts +++ b/projects/cdk/schematics/ng-update/v4/migrate-icons/rename-icons.ts @@ -36,7 +36,10 @@ export function renameIcons(pattern = ALL_FILES): void { from: new RegExp(`["'\`]${from}["'\`]`, 'g'), to, })).forEach(({from, to}) => { - text = text.replaceAll(from, `"${to}"`); + text = text.replaceAll( + from, + (match) => `${match.slice(0, 1)}${to}${match.slice(0, 1)}`, + ); }); const regex = /['"`]tuiIcon(?!Button\b)[A-Z][a-zA-Z0-9]*\b/g; diff --git a/projects/cdk/schematics/ng-update/v4/tests/schematic-migrate-icons.spec.ts b/projects/cdk/schematics/ng-update/v4/tests/schematic-migrate-icons.spec.ts index 77961edc3592..8d54af499445 100644 --- a/projects/cdk/schematics/ng-update/v4/tests/schematic-migrate-icons.spec.ts +++ b/projects/cdk/schematics/ng-update/v4/tests/schematic-migrate-icons.spec.ts @@ -87,6 +87,7 @@ const TEMPLATE_BEFORE = ` > + `; const TEMPLATE_AFTER = ` @@ -100,6 +101,7 @@ const TEMPLATE_AFTER = ` > + `; const PROPRIETARY_TEMPLATE_BEFORE = `