diff options
author | Tatu Lund <tatu@vaadin.com> | 2020-10-22 14:16:17 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-22 14:16:17 +0300 |
commit | 6300b4a9a52dd9cde18df077d20c114ddaa2669f (patch) | |
tree | e14aed3dd9f4188b2994d0dfaaf82c09bc073f7a /client | |
parent | 9c7cbaae947ff9e99faa395d77ac2254f32bd5c3 (diff) | |
download | vaadin-framework-6300b4a9a52dd9cde18df077d20c114ddaa2669f.tar.gz vaadin-framework-6300b4a9a52dd9cde18df077d20c114ddaa2669f.zip |
Use generated id of the menu item to help testing of the menubar (#12124)
Use generated IDs for MenuItems when an ID is set for MenuBar. Tying the ID to MenuBar's ID helps with the possible case of having multiple MenuBars on the same view and avoids to have excess id's when not needed.
Fixes: https://github.com/vaadin/framework/issues/8186
Diffstat (limited to 'client')
-rw-r--r-- | client/src/main/java/com/vaadin/client/ui/menubar/MenuBarConnector.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/menubar/MenuBarConnector.java b/client/src/main/java/com/vaadin/client/ui/menubar/MenuBarConnector.java index a66cd59851..f739d16fe4 100644 --- a/client/src/main/java/com/vaadin/client/ui/menubar/MenuBarConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/menubar/MenuBarConnector.java @@ -139,6 +139,11 @@ public class MenuBarConnector extends AbstractComponentConnector currentItem.setId("" + itemId); currentItem.updateFromUIDL(item, client); + String domId = getState().id; + if (domId != null && !domId.isEmpty()) { + currentItem.getElement().setId(domId+"-"+itemId); + } + if (item.getChildCount() > 0) { menuStack.push(currentMenu); iteratorStack.push(itr); |