| 1599 | describe('calling init', () => { |
| 1600 | function initialize(options: Options) { |
| 1601 | @Component({ |
| 1602 | selector: 'my-child', |
| 1603 | template: '', |
| 1604 | standalone: false, |
| 1605 | }) |
| 1606 | class MyChild { |
| 1607 | private thrown = LifetimeMethods.None; |
| 1608 | |
| 1609 | @Input() inp: boolean | undefined; |
| 1610 | @Output() outp = new EventEmitter<any>(); |
| 1611 | |
| 1612 | constructor() {} |
| 1613 | |
| 1614 | ngDoCheck() { |
| 1615 | this.check(LifetimeMethods.ngDoCheck); |
| 1616 | } |
| 1617 | ngOnInit() { |
| 1618 | this.check(LifetimeMethods.ngOnInit); |
| 1619 | } |
| 1620 | ngOnChanges() { |
| 1621 | this.check(LifetimeMethods.ngOnChanges); |
| 1622 | } |
| 1623 | ngAfterViewInit() { |
| 1624 | this.check(LifetimeMethods.ngAfterViewInit); |
| 1625 | } |
| 1626 | ngAfterContentInit() { |
| 1627 | this.check(LifetimeMethods.ngAfterContentInit); |
| 1628 | } |
| 1629 | |
| 1630 | private check(method: LifetimeMethods) { |
| 1631 | log(`MyChild::${LifetimeMethods[method]}()`); |
| 1632 | |
| 1633 | if ((options.childRecursion & method) !== 0) { |
| 1634 | if (logged.length < 20) { |
| 1635 | this.outp.emit(null); |
| 1636 | } else { |
| 1637 | fail(`Unexpected MyChild::${LifetimeMethods[method]} recursion`); |
| 1638 | } |
| 1639 | } |
| 1640 | if ((options.childThrows & method) !== 0) { |
| 1641 | if ((this.thrown & method) === 0) { |
| 1642 | this.thrown |= method; |
| 1643 | log(`<THROW from MyChild::${LifetimeMethods[method]}>()`); |
| 1644 | throw new Error(`Throw from MyChild::${LifetimeMethods[method]}`); |
| 1645 | } |
| 1646 | } |
| 1647 | } |
| 1648 | } |
| 1649 | |
| 1650 | @Component({ |
| 1651 | selector: 'my-component', |