Search in sources :

Example 26 with MenuItem

use of com.vaadin.flow.component.contextmenu.MenuItem in project flow-components by vaadin.

the class MenuBarTest method addChildrenWithClickListeners_getChildren_getItems.

@Test
public void addChildrenWithClickListeners_getChildren_getItems() {
    MenuItem item3 = menuBar.addItem("foo", e -> {
    });
    MenuItem item4 = menuBar.addItem(new Span("bar"), e -> {
    });
    assertChildrenAndItems(item1, item2, item3, item4);
}
Also used : MenuItem(com.vaadin.flow.component.contextmenu.MenuItem) Span(com.vaadin.flow.component.html.Span) Test(org.junit.Test)

Example 27 with MenuItem

use of com.vaadin.flow.component.contextmenu.MenuItem in project flow-components by vaadin.

the class MenuBarTest method removeNonChildItem_throws.

@Test(expected = IllegalArgumentException.class)
public void removeNonChildItem_throws() {
    MenuItem item = new MenuBar().addItem("foo");
    menuBar.remove(item);
}
Also used : MenuBar(com.vaadin.flow.component.menubar.MenuBar) MenuItem(com.vaadin.flow.component.contextmenu.MenuItem) Test(org.junit.Test)

Aggregations

MenuItem (com.vaadin.flow.component.contextmenu.MenuItem)27 MenuBar (com.vaadin.flow.component.menubar.MenuBar)9 Test (org.junit.jupiter.api.Test)8 ContextMenu (com.vaadin.flow.component.contextmenu.ContextMenu)6 Label (com.vaadin.flow.component.html.Label)6 Component (com.vaadin.flow.component.Component)5 SubMenu (com.vaadin.flow.component.contextmenu.SubMenu)5 Text (com.vaadin.flow.component.Text)2 Button (com.vaadin.flow.component.button.Button)2 Hr (com.vaadin.flow.component.html.Hr)2 Span (com.vaadin.flow.component.html.Span)2 Icon (com.vaadin.flow.component.icon.Icon)2 VaadinIcon (com.vaadin.flow.component.icon.VaadinIcon)2 Registration (com.vaadin.flow.shared.Registration)2 Test (org.junit.Test)2 AttachEvent (com.vaadin.flow.component.AttachEvent)1 ComponentEvent (com.vaadin.flow.component.ComponentEvent)1 ComponentEventListener (com.vaadin.flow.component.ComponentEventListener)1 DetachEvent (com.vaadin.flow.component.DetachEvent)1 UI (com.vaadin.flow.component.UI)1