| 978 | |
| 979 | it('should throw if required query is read in the constructor', () => { |
| 980 | @Component({ |
| 981 | template: `<div #el></div>`, |
| 982 | }) |
| 983 | class AppComponent { |
| 984 | divEl = viewChild.required<ElementRef<HTMLDivElement>>('el'); |
| 985 | |
| 986 | constructor() { |
| 987 | this.divEl(); |
| 988 | } |
| 989 | } |
| 990 | |
| 991 | // non-required query results are undefined before we run creation mode on the view queries |
| 992 | expect(() => { |