Search in sources :

Example 11 with HTMLOptionElement

use of elemental2.dom.HTMLOptionElement 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);
}
Also used : HTMLOptionElement(elemental2.dom.HTMLOptionElement) DataType(org.kie.workbench.common.dmn.client.editors.types.common.DataType) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.junit.Test)

Example 12 with HTMLOptionElement

use of elemental2.dom.HTMLOptionElement in project kie-wb-common by kiegroup.

the class TimeSelectorView method createOptionWithOffset.

HTMLOptionElement createOptionWithOffset(final String timeZoneOffSet) {
    final HTMLOptionElement option = getNewOption();
    option.value = timeZoneOffSet;
    option.text = timeZoneOffSet;
    return option;
}
Also used : HTMLOptionElement(elemental2.dom.HTMLOptionElement)

Example 13 with HTMLOptionElement

use of elemental2.dom.HTMLOptionElement in project kie-wb-common by kiegroup.

the class DataTypeSelectView method makeOption.

HTMLOptionElement makeOption(final DataType dataType, final Function<DataType, String> dataTypeConsumer) {
    final String optionValue = dataTypeConsumer.apply(dataType);
    final HTMLOptionElement option = makeHTMLOptionElement();
    option.text = optionValue;
    option.value = optionValue;
    return option;
}
Also used : HTMLOptionElement(elemental2.dom.HTMLOptionElement)

Example 14 with HTMLOptionElement

use of elemental2.dom.HTMLOptionElement in project kie-wb-common by kiegroup.

the class DataTypeSelectView method makeOptionGroup.

HTMLOptGroupElement makeOptionGroup(final String groupTitle, final List<DataType> dataTypes, final Function<DataType, String> dataTypeConsumer) {
    final HTMLOptGroupElement optionGroup = makeHTMLOptGroupElement();
    optionGroup.label = groupTitle;
    dataTypes.stream().forEach(dataType -> {
        final HTMLOptionElement option = makeOption(dataType, dataTypeConsumer);
        optionGroup.appendChild(option);
    });
    return optionGroup;
}
Also used : HTMLOptGroupElement(elemental2.dom.HTMLOptGroupElement) HTMLOptionElement(elemental2.dom.HTMLOptionElement)

Example 15 with HTMLOptionElement

use of elemental2.dom.HTMLOptionElement in project kie-wb-common by kiegroup.

the class TimeSelectorViewTest method testReloadTimeZoneSelectorIsNotOffsetMode.

@Test
public void testReloadTimeZoneSelectorIsNotOffsetMode() {
    final HTMLOptionElement none = mock(HTMLOptionElement.class);
    doReturn(none).when(view).createNoneOption();
    doReturn(false).when(view).getIsOffsetMode();
    view.reloadTimeZoneSelector();
    verify(view, never()).populateTimeZoneSelectorWithOffSets();
    verify(view).populateTimeZoneSelectorWithIds();
}
Also used : HTMLOptionElement(elemental2.dom.HTMLOptionElement) Test(org.junit.Test)

Aggregations

HTMLOptionElement (elemental2.dom.HTMLOptionElement)20 Test (org.junit.Test)11 HTMLOptGroupElement (elemental2.dom.HTMLOptGroupElement)3 DMNSimpleTimeZone (org.kie.workbench.common.dmn.api.editors.types.DMNSimpleTimeZone)3 DataType (org.kie.workbench.common.dmn.client.editors.types.common.DataType)3 Function (java.util.function.Function)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 Lists (org.kie.soup.commons.util.Lists)1 BuiltInType (org.kie.workbench.common.dmn.api.property.dmn.types.BuiltInType)1 DataTypeManager (org.kie.workbench.common.dmn.client.editors.types.common.DataTypeManager)1