| 40 | import {SignalFormControl} from '../../compat'; |
| 41 | |
| 42 | @Component({ |
| 43 | selector: 'my-fvc-input', |
| 44 | template: |
| 45 | '<input #i [value]="value()" (input)="value.set(i.value)" (blur)="touch.emit()" [disabled]="disabled()" />', |
| 46 | }) |
| 47 | class MyFvcInput implements FormValueControl<string> { |
| 48 | readonly value = model(''); |
| 49 | readonly touch = output<void>(); |
| 50 | readonly disabled = input(false); |
| 51 | readonly touched = input(false); |
| 52 | readonly dirty = input(false); |
| 53 | readonly valid = input(true); |
| 54 | readonly invalid = input(false); |
| 55 | readonly pending = input(false); |
| 56 | readonly required = input(false); |
| 57 | readonly errors = input<readonly any[]>([]); |
| 58 | } |
| 59 | |
| 60 | describe('FormControlDirective with FVC', () => { |
| 61 | it('should sync FormControl value to FVC (model -> view)', () => { |