Skip to content

Commit

Permalink
prettier fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dobanisola-scottlogic committed Apr 30, 2024
1 parent b1f9023 commit 95ea262
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
9 changes: 4 additions & 5 deletions src/app/components/megamenu/megamenu.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -507,21 +507,20 @@ 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('');
expect(megamenu.focusedItemInfo().item.label).toBe('TV');
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');
Expand Down
3 changes: 2 additions & 1 deletion src/app/components/megamenu/megamenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 95ea262

Please sign in to comment.