use of org.kie.workbench.common.dmn.client.editors.types.common.DataType in project kie-wb-common by kiegroup.
the class DataTypeListTest method testMakeTreeListItems.
@Test
public void testMakeTreeListItems() {
final DataType item1 = makeDataType("item1", "iITem1");
final DataType item2 = makeDataType("item2", "iITem2");
final DataType item3 = makeDataType("item", "iITem", item1, item2);
final List<DataTypeListItem> listItems = dataTypeList.makeTreeListItems(item3, 1);
verify(dataTypeList).makeTreeListItems(item3, 1);
verify(dataTypeList).makeTreeListItems(item1, 2);
verify(dataTypeList).makeTreeListItems(item2, 2);
assertEquals(3, listItems.size());
}
use of org.kie.workbench.common.dmn.client.editors.types.common.DataType in project kie-wb-common by kiegroup.
the class DataTypeSelectViewTest method testDisableEditMode.
@Test
public void testDisableEditMode() {
final String expectedTypeText = "type";
final DataType dataType = makeDataType(expectedTypeText);
doNothing().when(view).hideSelectPicker();
when(presenter.getDataType()).thenReturn(dataType);
typeText.classList = mock(DOMTokenList.class);
view.disableEditMode();
assertEquals(expectedTypeText, typeText.textContent);
verify(typeText.classList).remove(HIDDEN_CSS_CLASS);
verify(view).hideSelectPicker();
}
use of org.kie.workbench.common.dmn.client.editors.types.common.DataType in project kie-wb-common by kiegroup.
the class DataTypeSelectViewTest method testOnTypeTextClickWhenItsNotBuiltInType.
@Test
public void testOnTypeTextClickWhenItsNotBuiltInType() {
final ClickEvent event = mock(ClickEvent.class);
final String type = "tPerson";
final DataType dataType = makeDataType(type);
final HTMLElement element = mock(HTMLElement.class);
when(presenter.getDataType()).thenReturn(dataType);
doReturn(element).when(view).getElement();
view.onTypeTextClick(event);
verify(structureTypesTooltip).show(element, type);
verify(event).preventDefault();
verify(event).stopPropagation();
}
use of org.kie.workbench.common.dmn.client.editors.types.common.DataType in project kie-wb-common by kiegroup.
the class DataTypeConfirmationTest method testIfIsNotReferencedDataTypeWhenCallbackIsNotExecuted.
@Test
public void testIfIsNotReferencedDataTypeWhenCallbackIsNotExecuted() {
final DataType dataType = mock(DataType.class);
final DataType dataType1 = mock(DataType.class);
final DataType dataType2 = mock(DataType.class);
final List<DataType> allDataTypes = asList(dataType1, dataType2);
final FlashMessage warningMessage = mock(FlashMessage.class);
final Command onSuccess = mock(Command.class);
final String tCity = "tCity";
final String tPerson = "tPerson";
when(dataType.getName()).thenReturn(tCity);
when(dataType1.getType()).thenReturn(tCity);
when(dataType2.getType()).thenReturn(tPerson);
when(referencedDataTypeWarningMessage.getFlashMessage(eq(dataType), eq(onSuccess), any())).thenReturn(warningMessage);
when(dataTypeStore.all()).thenReturn(allDataTypes);
confirmation.ifIsNotReferencedDataType(dataType, onSuccess);
verify(onSuccess, never()).execute();
verify(flashMessageEvent).fire(warningMessage);
}
use of org.kie.workbench.common.dmn.client.editors.types.common.DataType in project kie-wb-common by kiegroup.
the class DataTypeConfirmationTest method testIfIsNotReferencedDataTypeWhenCallbackIsExecuted.
@Test
public void testIfIsNotReferencedDataTypeWhenCallbackIsExecuted() {
final DataType dataType = mock(DataType.class);
final DataType dataType1 = mock(DataType.class);
final DataType dataType2 = mock(DataType.class);
final List<DataType> allDataTypes = asList(dataType1, dataType2);
final Command callback = mock(Command.class);
final String tCity = "tCity";
final String tPerson = "tPerson";
final String tDocument = "tDocument";
when(dataType.getName()).thenReturn(tCity);
when(dataType1.getType()).thenReturn(tDocument);
when(dataType2.getType()).thenReturn(tPerson);
when(dataTypeStore.all()).thenReturn(allDataTypes);
confirmation.ifIsNotReferencedDataType(dataType, callback);
verify(callback).execute();
}
Aggregations