From 54c6a8d0b6bca30e7315d28ea987bfce21d1b46b Mon Sep 17 00:00:00 2001 From: Vladimir Potekhin <46284632+vladimirpotekhin@users.noreply.github.com> Date: Tue, 13 Aug 2024 18:48:34 +0300 Subject: [PATCH] chore: fix some icons migration (#8512) --- .../schematics/ng-update/v4/migrate-icons/rename-icons.ts | 5 ++++- .../ng-update/v4/tests/schematic-migrate-icons.spec.ts | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) 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 = `