Our blazing fast Grid component built with pure JavaScript


Post by henrique »

Hi!

I need some help. I trying to create an automated test, simulating a menu click. My problem is, how I do it?

If I call the "doAction" from the menu item is raised an error "Cannot read properties of undefined (reading 'close')", this erro is because in menu item implementation, the rootMenu is "undefined".

Any suggestion to fix this?


Post by tasnim »

Hi,

Can you please share the code snippet you're using to achieve it?


Post by henrique »

I'm trying to create a code snippet in the examples page, but I'm getting another error. Below is the code that is giving error:

import { Grid, DataGenerator, Menu, MenuItem } from '../../build/grid.module.js?474079';
import shared from '../_shared/shared.module.js?474079';

let SubMenu = new MenuItem({
    text: 'Main Menu',
    onItem: () => {console.log('Submenu clicked')}
});

let MainMenu = new MenuItem({
    appendTo : 'container',
    text: 'Main Menu',
    onItem: () => {console.log('Clicked')},
    menu: [
      SubMenu
 ]
});

I know it's a little weird, but I'm trying to create a side menu in my app. But with the errors I having is difficult to continue.


Post by Animal »

A MenuItem? appended to the container ?

You need a Menu first to use MenuItems in


Post by Animal »

But what's this about creating an automated test?

That's what Siesta does. It's a large and complex area, I would advise against trying to cobble together a test harness on your own.


Post by henrique »

Animal wrote: Thu Feb 15, 2024 3:16 pm

A MenuItem? appended to the container ?

You need a Menu first to use MenuItems in

Yes, I'm creating a side menu in my application. I placed a left-aligned container, with the menu items inside it and each menu item with its sub-menu.

It is any another way to do this?


Post by henrique »

Animal wrote: Thu Feb 15, 2024 3:18 pm

But what's this about creating an automated test?

That's what Siesta does. It's a large and complex area, I would advise against trying to cobble together a test harness on your own.

Yes, simulating the user using the menu, but when I tried to replicate the error, it's giving another error to me.


Post by Animal »

Why would you need a Container?

Just use a Menu.


Post by henrique »

In my sample I putted only one menu item, but in my application I have more than one.

I can't append a menu in a container or another widget, only in the button. And I need show to the user the list of menus.


Post by henrique »

And I can't use the Menu class because it is a popup, so the menu appears floating and not inside the container created for it!


Post Reply