File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed
Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,6 @@ export function assertDeferredDependenciesLoaded(tDetails: TDeferBlockDetails) {
141141 * that a primary template exists. All the other template options are optional.
142142 */
143143export function isTDeferBlockDetails ( value : unknown ) : value is TDeferBlockDetails {
144- return ( typeof value === 'object' ) &&
144+ return value !== null && ( typeof value === 'object' ) &&
145145 ( typeof ( value as TDeferBlockDetails ) . primaryTmplIndex === 'number' ) ;
146146}
Original file line number Diff line number Diff line change @@ -190,6 +190,39 @@ describe('DeferFixture', () => {
190190 expect ( el . querySelector ( '.more' ) ) . toBeDefined ( ) ;
191191 } ) ;
192192
193+ it ( 'should work with templates that have local refs' , async ( ) => {
194+ @Component ( {
195+ selector : 'defer-comp' ,
196+ standalone : true ,
197+ imports : [ SecondDeferredComp ] ,
198+ template : `
199+ <ng-template #template>Hello</ng-template>
200+ <div>
201+ @defer (on immediate) {
202+ <second-deferred-comp />
203+ }
204+ </div>
205+ `
206+ } )
207+ class DeferComp {
208+ }
209+
210+ TestBed . configureTestingModule ( {
211+ imports : [
212+ DeferComp ,
213+ SecondDeferredComp ,
214+ ] ,
215+ providers : COMMON_PROVIDERS ,
216+ deferBlockBehavior : DeferBlockBehavior . Manual ,
217+ } ) ;
218+
219+ const componentFixture = TestBed . createComponent ( DeferComp ) ;
220+ const deferBlock = ( await componentFixture . getDeferBlocks ( ) ) [ 0 ] ;
221+ const el = componentFixture . nativeElement as HTMLElement ;
222+ await deferBlock . render ( DeferBlockState . Complete ) ;
223+ expect ( el . querySelector ( '.more' ) ) . toBeDefined ( ) ;
224+ } ) ;
225+
193226 it ( 'should render a placeholder defer state' , async ( ) => {
194227 @Component ( {
195228 selector : 'defer-comp' ,
You can’t perform that action at this time.
0 commit comments