@@ -180,5 +180,33 @@ runInEachFileSystem(() => {
180180 expect ( diags [ 0 ] . category ) . toBe ( ts . DiagnosticCategory . Warning ) ;
181181 expect ( diags [ 0 ] . code ) . toBe ( ngErrorCode ( ErrorCode . DEFER_TRIGGER_MISCONFIGURATION ) ) ;
182182 } ) ;
183+
184+ it ( 'should emit when prefetch trigger is configured without a main trigger' , ( ) => {
185+ const diags = getDiags ( `@defer (prefetch on viewport(ref)) { <div></div> }` ) ;
186+ expect ( diags . length ) . toBe ( 1 ) ;
187+ expect ( diags [ 0 ] . category ) . toBe ( ts . DiagnosticCategory . Warning ) ;
188+ expect ( diags [ 0 ] . code ) . toBe ( ngErrorCode ( ErrorCode . DEFER_TRIGGER_MISCONFIGURATION ) ) ;
189+ } ) ;
190+
191+ it ( 'should emit when prefetch timer is configured without a main trigger' , ( ) => {
192+ const diags = getDiags ( `@defer (prefetch on timer(500ms)) { <div></div> }` ) ;
193+ expect ( diags . length ) . toBe ( 1 ) ;
194+ expect ( diags [ 0 ] . category ) . toBe ( ts . DiagnosticCategory . Warning ) ;
195+ expect ( diags [ 0 ] . code ) . toBe ( ngErrorCode ( ErrorCode . DEFER_TRIGGER_MISCONFIGURATION ) ) ;
196+ } ) ;
197+
198+ it ( 'should emit when prefetch idle is configured without a main trigger' , ( ) => {
199+ const diags = getDiags ( `@defer (prefetch on idle(500)) { <div></div> }` ) ;
200+ expect ( diags . length ) . toBe ( 1 ) ;
201+ expect ( diags [ 0 ] . category ) . toBe ( ts . DiagnosticCategory . Warning ) ;
202+ expect ( diags [ 0 ] . code ) . toBe ( ngErrorCode ( ErrorCode . DEFER_TRIGGER_MISCONFIGURATION ) ) ;
203+ } ) ;
204+
205+ it ( 'should emit when prefetch when is configured without a main trigger' , ( ) => {
206+ const diags = getDiags ( `@defer (prefetch when true) { <div></div> }` ) ;
207+ expect ( diags . length ) . toBe ( 1 ) ;
208+ expect ( diags [ 0 ] . category ) . toBe ( ts . DiagnosticCategory . Warning ) ;
209+ expect ( diags [ 0 ] . code ) . toBe ( ngErrorCode ( ErrorCode . DEFER_TRIGGER_MISCONFIGURATION ) ) ;
210+ } ) ;
183211 } ) ;
184212} ) ;
0 commit comments