@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(); }
void populateTimeZoneSelectorWithIds() { RemoveHelper.removeChildren(timeZoneSelector); timeZoneSelector.appendChild(createNoneOption()); for (int i = 0; i < getTimeZones().size(); i++) { final DMNSimpleTimeZone timeZone = getTimeZones().get(i); final HTMLOptionElement option = createOptionWithId(timeZone); timeZoneSelector.appendChild(option); } setPickerValue(getSelectPicker(), getTimeZoneSelectedValue()); timeZoneSelectorRefresh(); }
TimeSelectorView implements TimeSelector.View { void populateTimeZoneSelectorWithIds() { RemoveHelper.removeChildren(timeZoneSelector); timeZoneSelector.appendChild(createNoneOption()); for (int i = 0; i < getTimeZones().size(); i++) { final DMNSimpleTimeZone timeZone = getTimeZones().get(i); final HTMLOptionElement option = createOptionWithId(timeZone); timeZoneSelector.appendChild(option); } setPickerValue(getSelectPicker(), getTimeZoneSelectedValue()); timeZoneSelectorRefresh(); } }
TimeSelectorView implements TimeSelector.View { void populateTimeZoneSelectorWithIds() { RemoveHelper.removeChildren(timeZoneSelector); timeZoneSelector.appendChild(createNoneOption()); for (int i = 0; i < getTimeZones().size(); i++) { final DMNSimpleTimeZone timeZone = getTimeZones().get(i); final HTMLOptionElement option = createOptionWithId(timeZone); timeZoneSelector.appendChild(option); } setPickerValue(getSelectPicker(), getTimeZoneSelectedValue()); timeZoneSelectorRefresh(); } @Inject  TimeSelectorView(final HTMLInputElement timeInput,
                            final TimePicker picker,
                            final TimeZoneProvider timeZoneProvider,
                            final TimeValueFormatter formatter,
                            final @Named("i") HTMLElement toggleTimeZoneIcon,
                            final HTMLButtonElement toggleTimeZoneButton,
                            final ClientTranslationService translationService,
                            final HTMLSelectElement timeZoneSelector,
                            final HTMLOptionElement typeSelectOption); }
TimeSelectorView implements TimeSelector.View { void populateTimeZoneSelectorWithIds() { RemoveHelper.removeChildren(timeZoneSelector); timeZoneSelector.appendChild(createNoneOption()); for (int i = 0; i < getTimeZones().size(); i++) { final DMNSimpleTimeZone timeZone = getTimeZones().get(i); final HTMLOptionElement option = createOptionWithId(timeZone); timeZoneSelector.appendChild(option); } setPickerValue(getSelectPicker(), getTimeZoneSelectedValue()); timeZoneSelectorRefresh(); } @Inject  TimeSelectorView(final HTMLInputElement timeInput,
                            final TimePicker picker,
                            final TimeZoneProvider timeZoneProvider,
                            final TimeValueFormatter formatter,
                            final @Named("i") HTMLElement toggleTimeZoneIcon,
                            final HTMLButtonElement toggleTimeZoneButton,
                            final ClientTranslationService translationService,
                            final HTMLSelectElement timeZoneSelector,
                            final HTMLOptionElement typeSelectOption); void onSelectChange(final JQuerySelectPickerEvent event); @Override String getValue(); @Override void setValue(final String value); @Override void setPlaceholder(final String placeholder); @Override void setOnInputChangeCallback(final Consumer<Event> onValueChanged); @Override void select(); @Override void setOnInputBlurCallback(final Consumer<BlurEvent> onValueInputBlur); @EventHandler("time-input") void onTimeInputBlur(final BlurEvent blurEvent); @EventHandler("toggle-timezone-button") void onToggleTimeZoneButtonClick(final ClickEvent clickEvent); @Override boolean isChildOfView(final Object element); @Override void init(final TimeSelectorView presenter); }
TimeSelectorView implements TimeSelector.View { void populateTimeZoneSelectorWithIds() { RemoveHelper.removeChildren(timeZoneSelector); timeZoneSelector.appendChild(createNoneOption()); for (int i = 0; i < getTimeZones().size(); i++) { final DMNSimpleTimeZone timeZone = getTimeZones().get(i); final HTMLOptionElement option = createOptionWithId(timeZone); timeZoneSelector.appendChild(option); } setPickerValue(getSelectPicker(), getTimeZoneSelectedValue()); timeZoneSelectorRefresh(); } @Inject  TimeSelectorView(final HTMLInputElement timeInput,
                            final TimePicker picker,
                            final TimeZoneProvider timeZoneProvider,
                            final TimeValueFormatter formatter,
                            final @Named("i") HTMLElement toggleTimeZoneIcon,
                            final HTMLButtonElement toggleTimeZoneButton,
                            final ClientTranslationService translationService,
                            final HTMLSelectElement timeZoneSelector,
                            final HTMLOptionElement typeSelectOption); void onSelectChange(final JQuerySelectPickerEvent event); @Override String getValue(); @Override void setValue(final String value); @Override void setPlaceholder(final String placeholder); @Override void setOnInputChangeCallback(final Consumer<Event> onValueChanged); @Override void select(); @Override void setOnInputBlurCallback(final Consumer<BlurEvent> onValueInputBlur); @EventHandler("time-input") void onTimeInputBlur(final BlurEvent blurEvent); @EventHandler("toggle-timezone-button") void onToggleTimeZoneButtonClick(final ClickEvent clickEvent); @Override boolean isChildOfView(final Object element); @Override void init(final TimeSelectorView presenter);  }