Skip to content

Commit

Permalink
chore(cdk): fix labeled migration (#9602)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimirpotekhin authored Oct 28, 2024
1 parent 5b43400 commit 4f741b2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ export function migrateLabeled({
);
recorder.remove(
templateOffset + (sourceCodeLocation.endTag?.startOffset ?? 0),
`<${tagName}/>`.length,
(sourceCodeLocation.endTag?.endOffset ?? 0) -
(sourceCodeLocation.endTag?.startOffset ?? 0),
);
recorder.insertRight(
templateOffset + (sourceCodeLocation.endTag?.startOffset || 1),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ const TEMPLATE_BEFORE = `<tui-checkbox-labeled [(ngModel)]="value">
<tui-radio-labeled size="l" [formControl]="control" [item]="value" [identityMatcher]="matcher" [pseudoDisabled]="disabled">
Label
</tui-radio-labeled>
<tui-checkbox-labeled
*ngFor="let language of getLanguages()"
[formControlName]="language.name"
size="l"
class="test"
>{{ language.name }}</tui-checkbox-labeled
>
`;

const TEMPLATE_AFTER = `<label tuiLabel><input tuiCheckbox type="checkbox" [(ngModel)]="value">
Expand All @@ -55,6 +63,13 @@ const TEMPLATE_AFTER = `<label tuiLabel><input tuiCheckbox type="checkbox" [(ngM
<input tuiRadio type="radio" size="m" [formControl]="control" [value]="value" [identityMatcher]="matcher" [tuiAppearanceState]="disabled ? 'disabled' : null">
Label
</label>
<label *ngFor="let language of getLanguages()" tuiLabel>
<input tuiCheckbox type="checkbox"
${''}
[formControlName]="language.name"
size="m"
class="test"
>{{ language.name }}</label>
`;

describe('ng-update', () => {
Expand Down

0 comments on commit 4f741b2

Please sign in to comment.