From 0bc0813a4b5e6c9a811e634962f442791908ecf2 Mon Sep 17 00:00:00 2001 From: Cameron Batt Date: Wed, 27 Sep 2023 20:34:52 +1000 Subject: [PATCH] Fix MegaMenu in jest using forwardRef --- src/app/components/megamenu/megamenu.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/components/megamenu/megamenu.ts b/src/app/components/megamenu/megamenu.ts index d351c273b92..0934fb18ca8 100755 --- a/src/app/components/megamenu/megamenu.ts +++ b/src/app/components/megamenu/megamenu.ts @@ -20,6 +20,7 @@ import { ViewChild, ViewEncapsulation, effect, + forwardRef, signal } from '@angular/core'; import { RouterModule } from '@angular/router'; @@ -226,7 +227,7 @@ export class MegaMenuSub { @ViewChild('menubar', { static: true }) menubarViewChild: ElementRef; - constructor(public el: ElementRef, public megaMenu: MegaMenu) {} + constructor(public el: ElementRef, @Inject(forwardRef(() => MegaMenu)) public megaMenu: MegaMenu) {} onItemClick(event: any, processedItem: any) { this.getItemProp(processedItem, 'command', { originalEvent: event, item: processedItem.item });