@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); }
void populateTimeZoneSelectorWithOffSets() { final List<String> offSets = timeZoneProvider.getTimeZonesOffsets(); RemoveHelper.removeChildren(timeZoneSelector); timeZoneSelector.appendChild(createNoneOption()); for (int i = 0; i < offSets.size(); i++) { final HTMLOptionElement option = createOptionWithOffset(offSets.get(i)); timeZoneSelector.appendChild(option); } setPickerValue(getSelectPicker(), getTimeZoneSelectedValue()); timeZoneSelectorRefresh(); }
TimeSelectorView implements TimeSelector.View { void populateTimeZoneSelectorWithOffSets() { final List<String> offSets = timeZoneProvider.getTimeZonesOffsets(); RemoveHelper.removeChildren(timeZoneSelector); timeZoneSelector.appendChild(createNoneOption()); for (int i = 0; i < offSets.size(); i++) { final HTMLOptionElement option = createOptionWithOffset(offSets.get(i)); timeZoneSelector.appendChild(option); } setPickerValue(getSelectPicker(), getTimeZoneSelectedValue()); timeZoneSelectorRefresh(); } }
TimeSelectorView implements TimeSelector.View { void populateTimeZoneSelectorWithOffSets() { final List<String> offSets = timeZoneProvider.getTimeZonesOffsets(); RemoveHelper.removeChildren(timeZoneSelector); timeZoneSelector.appendChild(createNoneOption()); for (int i = 0; i < offSets.size(); i++) { final HTMLOptionElement option = createOptionWithOffset(offSets.get(i)); 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 populateTimeZoneSelectorWithOffSets() { final List<String> offSets = timeZoneProvider.getTimeZonesOffsets(); RemoveHelper.removeChildren(timeZoneSelector); timeZoneSelector.appendChild(createNoneOption()); for (int i = 0; i < offSets.size(); i++) { final HTMLOptionElement option = createOptionWithOffset(offSets.get(i)); 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 populateTimeZoneSelectorWithOffSets() { final List<String> offSets = timeZoneProvider.getTimeZonesOffsets(); RemoveHelper.removeChildren(timeZoneSelector); timeZoneSelector.appendChild(createNoneOption()); for (int i = 0; i < offSets.size(); i++) { final HTMLOptionElement option = createOptionWithOffset(offSets.get(i)); 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);  }