diff --git a/src/app/components/megamenu/megamenu.spec.ts b/src/app/components/megamenu/megamenu.spec.ts index fba0fe147f4..3206ba9cc72 100755 --- a/src/app/components/megamenu/megamenu.spec.ts +++ b/src/app/components/megamenu/megamenu.spec.ts @@ -466,7 +466,7 @@ describe('MegaMenu', () => { expect(tv1Div.className).toContain('p-megamenu-col-2'); }); - it('should move to the next item onKeyboardArrowKeyDown',() => { + it('should move to the next item onKeyboardArrowKeyDown', () => { megamenu.model = [ { label: 'TV', @@ -507,9 +507,9 @@ describe('MegaMenu', () => { //focus on menu megamenu.onMenuFocus(new Event('')); fixture.detectChanges(); - + const parentMenuEl = fixture.debugElement.query(By.css('.p-megamenu-root-list')); - const tvEl = parentMenuEl.children[0]; + const tvEl = parentMenuEl.children[0]; expect(megamenu.focusedItemInfo().index).toBe(0); expect(megamenu.focusedItemInfo().parentKey).toBe(''); @@ -517,11 +517,10 @@ describe('MegaMenu', () => { expect(tvEl.attributes['aria-expanded']).toBe('false'); //simulate keyboard arrow down key press - const event = new KeyboardEvent('keydown', {key: 'ArrowDown', code: 'ArrowDown'}); + const event = new KeyboardEvent('keydown', { key: 'ArrowDown', code: 'ArrowDown' }); parentMenuEl.nativeElement.dispatchEvent(event); fixture.detectChanges(); - expect(onArrowDownKeySpy).toHaveBeenCalled(); expect(megamenu.focusedItemInfo().index).toBe(0); expect(megamenu.focusedItemInfo().parentKey).toBe('0_0_0'); diff --git a/src/app/components/megamenu/megamenu.ts b/src/app/components/megamenu/megamenu.ts index b1eead408db..01764486780 100755 --- a/src/app/components/megamenu/megamenu.ts +++ b/src/app/components/megamenu/megamenu.ts @@ -504,7 +504,8 @@ export class MegaMenu implements AfterContentInit, OnDestroy, OnInit { get visibleItems() { const processedItem = ObjectUtils.isNotEmpty(this.activeItem()) ? this.activeItem() : null; - return processedItem ? processedItem.items.reduce((items, col) => { + return processedItem + ? processedItem.items.reduce((items, col) => { col.forEach((submenu) => { submenu.items.forEach((a) => { items.push(a);