use of org.kie.workbench.common.dmn.client.editors.types.common.DataType in project kie-wb-common by kiegroup.
the class DataTypeSelectViewTest method testSetDataTypeWhenItsBuiltInType.
@Test
public void testSetDataTypeWhenItsBuiltInType() {
final String expectedType = "string";
final DataType dataType = makeDataType(expectedType);
view.setDataType(dataType);
final String actualType = view.getValue();
final String actualTypeText = typeText.textContent;
assertEquals(expectedType, actualType);
assertEquals(expectedType, actualTypeText);
verify(typeText).setAttribute(IS_BUILT_IN_TYPE_ATTR, true);
}
use of org.kie.workbench.common.dmn.client.editors.types.common.DataType in project kie-wb-common by kiegroup.
the class DataTypeSelectViewTest method testMakeOption.
@Test
public void testMakeOption() {
final String value = "value";
final DataType dataType = makeDataType(value);
final HTMLOptionElement htmlOptionElement = mock(HTMLOptionElement.class);
doReturn(htmlOptionElement).when(view).makeHTMLOptionElement();
final HTMLOptionElement option = view.makeOption(dataType, DataType::getName);
assertEquals(value, option.text);
assertEquals(value, option.value);
}
use of org.kie.workbench.common.dmn.client.editors.types.common.DataType in project kie-wb-common by kiegroup.
the class DataTypeSelectViewTest method makeDataType.
private DataType makeDataType(final String name) {
final DataType dataType = spy(new DataType(null));
doReturn("uuid").when(dataType).getUUID();
doReturn("parentUUID").when(dataType).getParentUUID();
doReturn(name).when(dataType).getName();
doReturn(name).when(dataType).getType();
return dataType;
}
use of org.kie.workbench.common.dmn.client.editors.types.common.DataType in project kie-wb-common by kiegroup.
the class DataTypeSelectViewTest method testOnTypeTextClickWhenItsBuiltInType.
@Test
public void testOnTypeTextClickWhenItsBuiltInType() {
final ClickEvent event = mock(ClickEvent.class);
final String type = "string";
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, never()).show(any(), anyString());
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 DataTypesPageTest method testMakeDataType.
@Test
public void testMakeDataType() {
final ItemDefinition itemDefinition = mock(ItemDefinition.class);
final DataType expectedDataType = mock(DataType.class);
when(dataTypeManager.from(itemDefinition)).thenReturn(dataTypeManager);
when(dataTypeManager.get()).thenReturn(expectedDataType);
final DataType actualDataType = page.makeDataType(itemDefinition);
assertEquals(expectedDataType, actualDataType);
}
Aggregations