| 304 | describe('in a @Component', () => { |
| 305 | it('should support `toSignal` as a class member initializer', () => { |
| 306 | @Component({ |
| 307 | template: '{{counter()}}', |
| 308 | changeDetection: ChangeDetectionStrategy.OnPush, |
| 309 | standalone: false, |
| 310 | }) |
| 311 | class TestCmp { |
| 312 | // Component creation should not run inside the template effect/consumer, |
| 313 | // hence using `toSignal` should be allowed/supported. |
| 314 | counter$ = new Subject<number>(); |
| 315 | counter = toSignal(this.counter$); |
| 316 | } |
| 317 | |
| 318 | const fixture = TestBed.createComponent(TestCmp); |
| 319 | fixture.detectChanges(); |