| 2230 | const log: string[] = []; |
| 2231 | |
| 2232 | @Component({ |
| 2233 | selector: 'hooks', |
| 2234 | template: `{{ name }}`, |
| 2235 | changeDetection: ChangeDetectionStrategy.Eager, |
| 2236 | }) |
| 2237 | class ComponentWithHooks { |
| 2238 | @Input() name: string | undefined; |
| 2239 | |
| 2240 | private log(msg: string) { |
| 2241 | log.push(msg); |
| 2242 | } |
| 2243 | |
| 2244 | ngOnChanges() { |
| 2245 | this.log('onChanges-' + this.name); |
| 2246 | } |
| 2247 | ngOnInit() { |
| 2248 | this.log('onInit-' + this.name); |
| 2249 | } |
| 2250 | ngDoCheck() { |
| 2251 | this.log('doCheck-' + this.name); |
| 2252 | } |
| 2253 | |
| 2254 | ngAfterContentInit() { |
| 2255 | this.log('afterContentInit-' + this.name); |
| 2256 | } |
| 2257 | ngAfterContentChecked() { |
| 2258 | this.log('afterContentChecked-' + this.name); |
| 2259 | } |
| 2260 | |
| 2261 | ngAfterViewInit() { |
| 2262 | this.log('afterViewInit-' + this.name); |
| 2263 | } |
| 2264 | ngAfterViewChecked() { |
| 2265 | this.log('afterViewChecked-' + this.name); |
| 2266 | } |
| 2267 | |
| 2268 | ngOnDestroy() { |
| 2269 | this.log('onDestroy-' + this.name); |
| 2270 | } |
| 2271 | } |
| 2272 | |
| 2273 | it('should call all hooks in correct order when creating with createEmbeddedView', () => { |
| 2274 | @Component({ |