Skip to content

Test case for mat-menu. #195

@pradhanadi

Description

@pradhanadi

So I have a component that uses mat-menu. When I call fireEvent.click(), I get an error: TestingLibraryElementError: Unable to find role="menu" in console.

test('it should open pages menu on button click', async () => {
  
  let component = await render(PaginationComponent, {
    imports:[MaterialModule]
  });
  let buttonCLick = fireEvent.click(screen.getByTestId('openChangePageSizeMenu'));
  expect(buttonCLick).toBeTruthy();

  await screen.findByRole('menu');

});

This is the code that I wrote. Can someone help me out? I am fairly new in Testing.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions