| 1580 | describe('calling init', () => { |
| 1581 | function initialize(options: Options) { |
| 1582 | @Component({ |
| 1583 | selector: 'my-child', |
| 1584 | template: '', |
| 1585 | }) |
| 1586 | class MyChild { |
| 1587 | private thrown = LifetimeMethods.None; |
| 1588 | |
| 1589 | @Input() inp: boolean | undefined; |
| 1590 | @Output() outp = new EventEmitter<any>(); |
| 1591 | |
| 1592 | constructor() {} |
| 1593 | |
| 1594 | ngDoCheck() { |
| 1595 | this.check(LifetimeMethods.ngDoCheck); |
| 1596 | } |
| 1597 | ngOnInit() { |
| 1598 | this.check(LifetimeMethods.ngOnInit); |
| 1599 | } |
| 1600 | ngOnChanges() { |
| 1601 | this.check(LifetimeMethods.ngOnChanges); |
| 1602 | } |
| 1603 | ngAfterViewInit() { |
| 1604 | this.check(LifetimeMethods.ngAfterViewInit); |
| 1605 | } |
| 1606 | ngAfterContentInit() { |
| 1607 | this.check(LifetimeMethods.ngAfterContentInit); |
| 1608 | } |
| 1609 | |
| 1610 | private check(method: LifetimeMethods) { |
| 1611 | log(`MyChild::${LifetimeMethods[method]}()`); |
| 1612 | |
| 1613 | if ((options.childRecursion & method) !== 0) { |
| 1614 | if (logged.length < 20) { |
| 1615 | this.outp.emit(null); |
| 1616 | } else { |
| 1617 | fail(`Unexpected MyChild::${LifetimeMethods[method]} recursion`); |
| 1618 | } |
| 1619 | } |
| 1620 | if ((options.childThrows & method) !== 0) { |
| 1621 | if ((this.thrown & method) === 0) { |
| 1622 | this.thrown |= method; |
| 1623 | log(`<THROW from MyChild::${LifetimeMethods[method]}>()`); |
| 1624 | throw new Error(`Throw from MyChild::${LifetimeMethods[method]}`); |
| 1625 | } |
| 1626 | } |
| 1627 | } |
| 1628 | } |
| 1629 | |
| 1630 | @Component({ |
| 1631 | selector: 'my-component', |