use of elemental2.dom.HTMLOptionElement in project kie-wb-common by kiegroup.
the class TimeSelectorViewTest method testCreateOptionWithOffset.
@Test
public void testCreateOptionWithOffset() {
final String offset = "offset";
final HTMLOptionElement option = new HTMLOptionElement();
doReturn(option).when(view).getNewOption();
view.createOptionWithOffset(offset);
assertEquals(offset, option.value);
assertEquals(offset, option.text);
}
use of elemental2.dom.HTMLOptionElement in project kie-wb-common by kiegroup.
the class TimeSelectorViewTest method testPopulateTimeZoneSelectorWithIds.
@Test
public void testPopulateTimeZoneSelectorWithIds() {
final HTMLOptionElement noneOption = mock(HTMLOptionElement.class);
final HTMLOptionElement tz1Option = mock(HTMLOptionElement.class);
final HTMLOptionElement tz2Option = mock(HTMLOptionElement.class);
final List<DMNSimpleTimeZone> timeZones = mock(List.class);
final DMNSimpleTimeZone tz1 = mock(DMNSimpleTimeZone.class);
final DMNSimpleTimeZone tz2 = mock(DMNSimpleTimeZone.class);
when(tz1.getId()).thenReturn("time zone 1");
when(tz2.getId()).thenReturn("other time zone");
when(timeZones.size()).thenReturn(2);
when(timeZones.get(0)).thenReturn(tz1);
when(timeZones.get(1)).thenReturn(tz2);
doReturn(tz1Option).when(view).createOptionWithId(tz1);
doReturn(tz2Option).when(view).createOptionWithId(tz2);
doReturn(timeZones).when(view).getTimeZones();
doReturn(noneOption).when(view).createNoneOption();
doNothing().when(view).timeZoneSelectorRefresh();
view.populateTimeZoneSelectorWithIds();
verify(timeZoneSelector).appendChild(noneOption);
verify(timeZoneSelector).appendChild(tz1Option);
verify(timeZoneSelector).appendChild(tz2Option);
verify(view).timeZoneSelectorRefresh();
}
use of elemental2.dom.HTMLOptionElement in project kie-wb-common by kiegroup.
the class TimeSelectorViewTest method testPopulateTimeZoneSelectorWithOffSets.
@Test
public void testPopulateTimeZoneSelectorWithOffSets() {
final HTMLOptionElement noneOption = mock(HTMLOptionElement.class);
final HTMLOptionElement option0 = mock(HTMLOptionElement.class);
final HTMLOptionElement option1 = mock(HTMLOptionElement.class);
final String os0 = "+01:00";
final String os1 = "-03:00";
final List<String> offsets = mock(List.class);
when(offsets.size()).thenReturn(2);
when(offsets.get(0)).thenReturn(os0);
when(offsets.get(1)).thenReturn(os1);
doReturn(noneOption).when(view).createNoneOption();
doReturn(option0).when(view).createOptionWithOffset(os0);
doReturn(option1).when(view).createOptionWithOffset(os1);
doNothing().when(view).timeZoneSelectorRefresh();
when(timeZoneProvider.getTimeZonesOffsets()).thenReturn(offsets);
view.populateTimeZoneSelectorWithOffSets();
verify(timeZoneSelector).appendChild(noneOption);
verify(timeZoneSelector).appendChild(option0);
verify(timeZoneSelector).appendChild(option1);
}
use of elemental2.dom.HTMLOptionElement in project kie-wb-common by kiegroup.
the class TimeSelectorViewTest method testCreateNoneOption.
@Test
public void testCreateNoneOption() {
final HTMLOptionElement noneOption = new HTMLOptionElement();
final String text = "text";
when(translationService.getValue(NONE_TRANSLATION_KEY)).thenReturn(text);
doReturn(noneOption).when(view).getNewOption();
view.createNoneOption();
assertEquals(NONE_VALUE, noneOption.value);
assertEquals(text, noneOption.text);
}
use of elemental2.dom.HTMLOptionElement in project kie-wb-common by kiegroup.
the class KieAssetsDropdownView method entryOption.
protected HTMLOptionElement entryOption(final KieAssetsDropdownItem entry) {
final HTMLOptionElement option = makeHTMLOptionElement();
option.text = entry.getText();
option.value = entry.getValue();
option.setAttribute(SELECT_PICKER_SUBTEXT_ATTRIBUTE, entry.getSubText());
return option;
}
Aggregations