Skip to content

Commit 4c264c9

Browse files
leonsenftAndrewKushnir
authored andcommitted
test(forms): make custom controls in test implement FormUiControl (angular#63884)
Fix type issues revealed by implementing the expected interface. PR Close angular#63884
1 parent 71e8672 commit 4c264c9

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

packages/forms/signals/test/web/control_directive.spec.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
type DisabledReason,
3434
type FieldTree,
3535
type FormCheckboxControl,
36+
type FormUiControl,
3637
type FormValueControl,
3738
type ValidationError,
3839
type WithOptionalField,
@@ -79,7 +80,7 @@ describe('control directive', () => {
7980

8081
it('custom control', () => {
8182
@Component({selector: 'custom-control', template: ``})
82-
class CustomControl {
83+
class CustomControl implements FormUiControl {
8384
readonly value = model(false);
8485
readonly disabled = input(false);
8586
}
@@ -153,7 +154,7 @@ describe('control directive', () => {
153154

154155
it('custom control', () => {
155156
@Component({selector: 'custom-control', template: `{{value()}}`})
156-
class CustomControl {
157+
class CustomControl implements FormUiControl {
157158
readonly value = model('');
158159
readonly name = input('');
159160
}
@@ -225,7 +226,7 @@ describe('control directive', () => {
225226

226227
it('custom control', () => {
227228
@Component({selector: 'custom-control', template: ``})
228-
class CustomControl {
229+
class CustomControl implements FormUiControl {
229230
readonly value = model('');
230231
readonly readonly = input(false);
231232
}
@@ -274,7 +275,7 @@ describe('control directive', () => {
274275

275276
it('custom control', () => {
276277
@Component({selector: 'custom-control', template: ``})
277-
class CustomControl {
278+
class CustomControl implements FormUiControl {
278279
readonly value = model('');
279280
readonly required = input(false);
280281
}
@@ -323,9 +324,9 @@ describe('control directive', () => {
323324

324325
it('custom control', () => {
325326
@Component({selector: 'custom-control', template: ``})
326-
class CustomControl {
327+
class CustomControl implements FormUiControl {
327328
readonly value = model(0);
328-
readonly max = input<number | null>(null);
329+
readonly max = input<number>();
329330
}
330331

331332
@Component({
@@ -388,7 +389,7 @@ describe('control directive', () => {
388389

389390
it('custom control', () => {
390391
@Component({selector: 'custom-control', template: ``})
391-
class CustomControl {
392+
class CustomControl implements FormUiControl {
392393
readonly value = model(0);
393394
readonly min = input<number>();
394395
}
@@ -453,9 +454,9 @@ describe('control directive', () => {
453454

454455
it('custom control', () => {
455456
@Component({selector: 'custom-control', template: ``})
456-
class CustomControl {
457+
class CustomControl implements FormUiControl {
457458
readonly value = model('');
458-
readonly maxLength = input<number | null>(null);
459+
readonly maxLength = input<number>();
459460
}
460461

461462
@Component({
@@ -518,9 +519,9 @@ describe('control directive', () => {
518519

519520
it('custom control', () => {
520521
@Component({selector: 'custom-control', template: ``})
521-
class CustomControl {
522+
class CustomControl implements FormUiControl {
522523
readonly value = model('');
523-
readonly minLength = input<number | null>(null);
524+
readonly minLength = input<number>();
524525
}
525526

526527
@Component({

0 commit comments

Comments
 (0)