Search in sources :

Example 6 with BaseMenuCustom

use of org.uberfire.workbench.model.menu.impl.BaseMenuCustom in project kie-wb-common by kiegroup.

the class ProjectEditorMenuSessionItemsTest method testIsEnabledWithRegisteredMenuItem.

@Test
public void testIsEnabledWithRegisteredMenuItem() {
    final MenuItem menuItem = new BaseMenuCustom<String>() {

        @Override
        public String build() {
            return "";
        }
    };
    when(itemsBuilder.newClearItem(Mockito.<Command>any())).thenReturn(menuItem);
    editorMenuSessionItems.populateMenu(fileMenuBuilder);
    editorMenuSessionItems.setItemEnabled(ClearSessionCommand.class, true);
    assertTrue(menuItem.isEnabled());
    editorMenuSessionItems.setItemEnabled(ClearSessionCommand.class, false);
    assertFalse(menuItem.isEnabled());
}
Also used : BaseMenuCustom(org.uberfire.workbench.model.menu.impl.BaseMenuCustom) MenuItem(org.uberfire.workbench.model.menu.MenuItem) Test(org.junit.Test)

Aggregations

BaseMenuCustom (org.uberfire.workbench.model.menu.impl.BaseMenuCustom)6 Test (org.junit.Test)5 MenuItem (org.uberfire.workbench.model.menu.MenuItem)3 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)1 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)1 Widget (com.google.gwt.user.client.ui.Widget)1 Button (org.gwtbootstrap3.client.ui.Button)1 ButtonGroup (org.gwtbootstrap3.client.ui.ButtonGroup)1 Divider (org.gwtbootstrap3.client.ui.Divider)1 DropDownMenu (org.gwtbootstrap3.client.ui.DropDownMenu)1 MenuFactory (org.uberfire.workbench.model.menu.MenuFactory)1