From 1f8de4a273cebef151e0962f9ec500057be4bbe0 Mon Sep 17 00:00:00 2001 From: Dobrin Dimchev Date: Mon, 29 Mar 2021 14:38:47 +0300 Subject: [PATCH] fix(ui5-shellbar): primary title menu is closed on content click (#3032) --- packages/fiori/src/ShellBar.js | 1 + packages/fiori/test/specs/ShellBar.spec.js | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/packages/fiori/src/ShellBar.js b/packages/fiori/src/ShellBar.js index db1a269787de..4f583d28a369 100644 --- a/packages/fiori/src/ShellBar.js +++ b/packages/fiori/src/ShellBar.js @@ -464,6 +464,7 @@ class ShellBar extends UI5Element { } _menuItemPress(event) { + this.menuPopover.close(); this.fireEvent("menu-item-click", { item: event.detail.item, }, true); diff --git a/packages/fiori/test/specs/ShellBar.spec.js b/packages/fiori/test/specs/ShellBar.spec.js index 9ee33935c857..d54e1204139e 100644 --- a/packages/fiori/test/specs/ShellBar.spec.js +++ b/packages/fiori/test/specs/ShellBar.spec.js @@ -28,6 +28,22 @@ describe("Component Behavior", () => { browser.url(`http://localhost:${PORT}/test-resources/pages/ShellBar.html`); }); + + describe("ui5-shellbar menu", () => { + it("tests close on content click", () => { + const primaryTitle = browser.$("#shellbar").shadow$(".ui5-shellbar-menu-button"); + const staticAreaItemClassName = browser.getStaticAreaItemClassName("#shellbar") + const menuPopover = browser.$(`.${staticAreaItemClassName}`).shadow$(".ui5-shellbar-menu-popover"); + const firstMenuItem = menuPopover.$("ui5-list > ui5-li"); + + primaryTitle.click(); + firstMenuItem.click(); + + assert.strictEqual(menuPopover.getProperty("opened"), false, "Count property propagates to ui5-button"); + }); + }); + + describe("ui5-shellbar-item", () => { it("tests count property", () => { const shellbar = browser.$("#shellbarwithitems"); @@ -300,6 +316,7 @@ describe("Component Behavior", () => { assert.strictEqual(input.getValue(), "Application 1", "Input value is set by click event of the first menu item"); assert.strictEqual(inputData.getValue(), "key1", "The user defined attributes are available."); + primaryTitle.click(); secondMenuItem.click(); assert.strictEqual(input.getValue(), "Application 2", "Input value is set by click event of the second menu item");