Skip to content

Commit

Permalink
chore: add menu test (#9397)
Browse files Browse the repository at this point in the history
  • Loading branch information
nnaydenow authored Jul 9, 2024
1 parent 9cc7aeb commit 5bc2453
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions packages/main/test/specs/Menu.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe("Menu interaction", () => {
.should("exist");
});

it("Sub-menu opening", () => {
it("Restore focus to previous element after close", () => {
cy.mount(html`<ui5-button id="btnOpen">Open Menu</ui5-button>
<ui5-menu open opener="btnOpen">
<ui5-menu-item text="Item 1.0" icon="open-folder">
Expand All @@ -60,8 +60,7 @@ describe("Menu interaction", () => {
cy.get("[ui5-menu]")
.ui5MenuOpened();


cy.get("[ui5-menu-item][text='Item 1.0']")
cy.get("[ui5-menu-item][text='Item 1.0']")
.as("item")
.ui5MenuItemClick();

Expand Down Expand Up @@ -155,6 +154,35 @@ describe("Menu interaction", () => {
.and("have.attr", "active")
});

it("Menu and Menu items busy indication - without items", () => {
cy.mount(html`<ui5-button id="btnOpen">Open Menu</ui5-button>
<ui5-menu id="menu">
<ui5-menu-item text="Item 1"></ui5-menu-item>
</ui5-menu>`)

cy.get("#btnOpen")
.as("button")
.realClick();

cy.get("@button")
.should("be.focused");

cy.get("[ui5-menu]")
.as("menu")
.ui5MenuOpen({
opener: "btnOpen"
});

cy.get("[ui5-menu]")
.ui5MenuOpened();

cy.get("[ui5-menu-item]")
.ui5MenuItemPress("Space");

cy.get("@button")
.should("be.focused");
});

describe("Event firing", () => {
it("Event firing - 'ui5-item-click' after 'click' on menu item", () => {
cy.mount(html`<ui5-button id="btnOpen">Open Menu</ui5-button>
Expand Down

0 comments on commit 5bc2453

Please sign in to comment.