use of org.uberfire.client.views.pfly.widgets.Moment in project kie-wb-common by kiegroup.
the class TimePicker method setDefaultData.
void setDefaultData() {
final Moment now = moment();
view.setDate(now);
}
use of org.uberfire.client.views.pfly.widgets.Moment in project kie-wb-common by kiegroup.
the class TimePickerTest method testRefreshDateInPopup.
@Test
public void testRefreshDateInPopup() {
final Moment moment = mock(Moment.class);
final String inputValue = "22:30:51";
int expectedHours = 22;
int expectedMinutes = 30;
int expectedSeconds = 51;
when(moment.isValid()).thenReturn(true);
when(moment.hours()).thenReturn(expectedHours);
when(moment.minutes()).thenReturn(expectedMinutes);
when(moment.seconds()).thenReturn(expectedSeconds);
doReturn(moment).when(picker).getDateInInput();
input.value = inputValue;
picker.refreshDateInPopup();
verify(view).setDate(momentArgumentCaptor.capture());
final Moment actual = momentArgumentCaptor.getValue();
assertEquals(expectedHours, actual.hours());
assertEquals(expectedMinutes, actual.minutes());
assertEquals(expectedSeconds, actual.seconds());
}
use of org.uberfire.client.views.pfly.widgets.Moment in project kie-wb-common by kiegroup.
the class TimePickerTest method testOnDateChanged.
@Test
public void testOnDateChanged() {
final Consumer<Moment> consumer = mock(Consumer.class);
picker.setOnDateChanged(consumer);
final String expected = "14:55:01";
final Moment moment = mock(Moment.class);
when(moment.format("HH:mm:ss")).thenReturn(expected);
picker.onDateChanged(moment);
assertEquals(expected, input.value);
verify(consumer).accept(argThat(argument -> Objects.equals(argument, moment)));
}
Aggregations