Search in sources :

Example 6 with DataTypeEditModeToggleEvent

use of org.kie.workbench.common.dmn.client.editors.types.listview.common.DataTypeEditModeToggleEvent in project kie-wb-common by kiegroup.

the class DMNDiagramEditorTest method testOnDataTypeEditModeToggleWhenEditModeIsNotEnabled.

@Test
public void testOnDataTypeEditModeToggleWhenEditModeIsNotEnabled() {
    final DataTypeEditModeToggleEvent editModeToggleEvent = mock(DataTypeEditModeToggleEvent.class);
    doNothing().when(diagramEditor).enableMenuItem(any());
    when(editModeToggleEvent.isEditModeEnabled()).thenReturn(false);
    diagramEditor.getOnDataTypeEditModeToggleCallback(editModeToggleEvent).onInvoke();
    verify(diagramEditor).enableMenuItem(MenuItems.SAVE);
}
Also used : DataTypeEditModeToggleEvent(org.kie.workbench.common.dmn.client.editors.types.listview.common.DataTypeEditModeToggleEvent) AbstractProjectDiagramEditorTest(org.kie.workbench.common.stunner.project.client.editor.AbstractProjectDiagramEditorTest) Test(org.junit.Test)

Example 7 with DataTypeEditModeToggleEvent

use of org.kie.workbench.common.dmn.client.editors.types.listview.common.DataTypeEditModeToggleEvent in project kie-wb-common by kiegroup.

the class DMNDiagramEditorTest method testOnDataTypeEditModeToggleWhenEditModeIsEnabled.

@Test
public void testOnDataTypeEditModeToggleWhenEditModeIsEnabled() {
    final DataTypeEditModeToggleEvent editModeToggleEvent = mock(DataTypeEditModeToggleEvent.class);
    doNothing().when(diagramEditor).disableMenuItem(any());
    when(editModeToggleEvent.isEditModeEnabled()).thenReturn(true);
    diagramEditor.getOnDataTypeEditModeToggleCallback(editModeToggleEvent).onInvoke();
    verify(diagramEditor).disableMenuItem(MenuItems.SAVE);
}
Also used : DataTypeEditModeToggleEvent(org.kie.workbench.common.dmn.client.editors.types.listview.common.DataTypeEditModeToggleEvent) AbstractProjectDiagramEditorTest(org.kie.workbench.common.stunner.project.client.editor.AbstractProjectDiagramEditorTest) Test(org.junit.Test)

Example 8 with DataTypeEditModeToggleEvent

use of org.kie.workbench.common.dmn.client.editors.types.listview.common.DataTypeEditModeToggleEvent in project kie-wb-common by kiegroup.

the class DataTypeListTest method testOnDataTypeEditModeToggleStartEditing.

@Test
public void testOnDataTypeEditModeToggleStartEditing() {
    final DataTypeListItem currentEditingItem = mock(DataTypeListItem.class);
    final DataTypeEditModeToggleEvent event = new DataTypeEditModeToggleEvent(true, currentEditingItem);
    dataTypeList.onDataTypeEditModeToggle(event);
    final DataTypeListItem actual = dataTypeList.getCurrentEditingItem();
    verify(searchBar).reset();
    assertEquals(currentEditingItem, actual);
}
Also used : DataTypeEditModeToggleEvent(org.kie.workbench.common.dmn.client.editors.types.listview.common.DataTypeEditModeToggleEvent) Test(org.junit.Test)

Example 9 with DataTypeEditModeToggleEvent

use of org.kie.workbench.common.dmn.client.editors.types.listview.common.DataTypeEditModeToggleEvent in project kie-wb-common by kiegroup.

the class DataTypeListTest method testOnDataTypeEditModeToggleStopEditing.

@Test
public void testOnDataTypeEditModeToggleStopEditing() {
    final DataTypeListItem currentEditingItem = mock(DataTypeListItem.class);
    final DataTypeEditModeToggleEvent event = new DataTypeEditModeToggleEvent(false, currentEditingItem);
    dataTypeList.onDataTypeEditModeToggle(event);
    final DataTypeListItem actual = dataTypeList.getCurrentEditingItem();
    verify(searchBar).reset();
    assertEquals(null, actual);
}
Also used : DataTypeEditModeToggleEvent(org.kie.workbench.common.dmn.client.editors.types.listview.common.DataTypeEditModeToggleEvent) Test(org.junit.Test)

Aggregations

DataTypeEditModeToggleEvent (org.kie.workbench.common.dmn.client.editors.types.listview.common.DataTypeEditModeToggleEvent)9 Test (org.junit.Test)7 Consumer (java.util.function.Consumer)2 AbstractProjectDiagramEditorTest (org.kie.workbench.common.stunner.project.client.editor.AbstractProjectDiagramEditorTest)2 MenuItem (org.uberfire.workbench.model.menu.MenuItem)2 Menus (org.uberfire.workbench.model.menu.Menus)2