| 2346 | const log: string[] = []; |
| 2347 | |
| 2348 | @Component({ |
| 2349 | selector: 'hooks', |
| 2350 | template: `{{ name }}`, |
| 2351 | standalone: false, |
| 2352 | |
| 2353 | changeDetection: ChangeDetectionStrategy.Eager, |
| 2354 | }) |
| 2355 | class ComponentWithHooks { |
| 2356 | @Input() name: string | undefined; |
| 2357 | |
| 2358 | private log(msg: string) { |
| 2359 | log.push(msg); |
| 2360 | } |
| 2361 | |
| 2362 | ngOnChanges() { |
| 2363 | this.log('onChanges-' + this.name); |
| 2364 | } |
| 2365 | ngOnInit() { |
| 2366 | this.log('onInit-' + this.name); |
| 2367 | } |
| 2368 | ngDoCheck() { |
| 2369 | this.log('doCheck-' + this.name); |
| 2370 | } |
| 2371 | |
| 2372 | ngAfterContentInit() { |
| 2373 | this.log('afterContentInit-' + this.name); |
| 2374 | } |
| 2375 | ngAfterContentChecked() { |
| 2376 | this.log('afterContentChecked-' + this.name); |
| 2377 | } |
| 2378 | |
| 2379 | ngAfterViewInit() { |
| 2380 | this.log('afterViewInit-' + this.name); |
| 2381 | } |
| 2382 | ngAfterViewChecked() { |
| 2383 | this.log('afterViewChecked-' + this.name); |
| 2384 | } |
| 2385 | |
| 2386 | ngOnDestroy() { |
| 2387 | this.log('onDestroy-' + this.name); |
| 2388 | } |
| 2389 | } |
| 2390 | |
| 2391 | it('should call all hooks in correct order when creating with createEmbeddedView', () => { |
| 2392 | @Component({ |