From 9c84c60365bc7c0ee1f12f35c829f4d5cbb0b99e Mon Sep 17 00:00:00 2001 From: Vladimir Potekhin Date: Mon, 16 Dec 2024 16:25:53 +0300 Subject: [PATCH] chore: fix block migration --- .cspell.json | 4 +++- .../v4/steps/constants/tags-to-replace.ts | 14 ++++++++++++++ .../v4/tests/schematic-migrate-blocked.spec.ts | 6 +++--- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.cspell.json b/.cspell.json index 6e5909793cd8..f2aba0275f30 100644 --- a/.cspell.json +++ b/.cspell.json @@ -13,7 +13,9 @@ "significand", "undoubtable", "Clintock", - "Bonorum" + "Bonorum", + "hidecheckbox", + "hideradio" ], "ignoreRegExpList": ["\\(https?://.*?\\)", "\\/{1}.+\\/{1}", "\\%2F.+", "\\%2C.+", "\\ɵ.+", "\\ыва.+"], "overrides": [ diff --git a/projects/cdk/schematics/ng-update/v4/steps/constants/tags-to-replace.ts b/projects/cdk/schematics/ng-update/v4/steps/constants/tags-to-replace.ts index a195a44adbed..40b86b7fe78e 100644 --- a/projects/cdk/schematics/ng-update/v4/steps/constants/tags-to-replace.ts +++ b/projects/cdk/schematics/ng-update/v4/steps/constants/tags-to-replace.ts @@ -31,15 +31,29 @@ export const TAGS_TO_REPLACE: ReplacementTag[] = [ to: 'input', addAttributes: ['tuiRadio', 'type="radio"'], }, + { + from: 'tui-checkbox-block', + to: 'input', + addAttributes: ['tuiCheckbox', 'type="checkbox"', 'tuiBlock'], + filterFn: (el) => el.attrs.some((attr) => attr.name === '[hidecheckbox]'), + }, { from: 'tui-checkbox-block', to: 'input', addAttributes: ['tuiCheckbox', 'type="checkbox"'], + filterFn: (el) => !el.attrs.some((attr) => attr.name === '[hidecheckbox]'), + }, + { + from: 'tui-radio-block', + to: 'input', + addAttributes: ['tuiRadio', 'type="radio"', 'tuiBlock'], + filterFn: (el) => el.attrs.some((attr) => attr.name === '[hideradio]'), }, { from: 'tui-radio-block', to: 'input', addAttributes: ['tuiRadio', 'type="radio"'], + filterFn: (el) => !el.attrs.some((attr) => attr.name === '[hideradio]'), }, { from: 'tui-hosted-dropdown', diff --git a/projects/cdk/schematics/ng-update/v4/tests/schematic-migrate-blocked.spec.ts b/projects/cdk/schematics/ng-update/v4/tests/schematic-migrate-blocked.spec.ts index b8801b2b5b7e..f412d8b32fa3 100644 --- a/projects/cdk/schematics/ng-update/v4/tests/schematic-migrate-blocked.spec.ts +++ b/projects/cdk/schematics/ng-update/v4/tests/schematic-migrate-blocked.spec.ts @@ -112,7 +112,7 @@ const TEMPLATE_AFTER = `