use of io.jmix.petclinic.entity.visit.Visit in project jmix-sneferu by mariodavid.
the class GetOpenedEditorScreenTest method given_editorScreenIsOpen_when_getOpenedScreen_then_screenIsReturned.
@Test
void given_editorScreenIsOpen_when_getOpenedScreen_then_screenIsReturned(Screens screens, UiTestAPI uiTestAPI) {
// given:
final VisitEdit screen = screens.create(VisitEdit.class);
screen.setEntityToEdit(dataManager.create(Visit.class));
// and:
screen.show();
// when:
final StandardEditorTestAPI<Visit, VisitEdit> openedScreen = uiTestAPI.getOpenedEditorScreen(VisitEdit.class);
// then:
assertThat(openedScreen.screen()).isEqualTo(screen);
}
use of io.jmix.petclinic.entity.visit.Visit in project jmix-sneferu by mariodavid.
the class VisitBrowse method onCalendarCalendarEventClick.
@Subscribe("calendar")
protected void onCalendarCalendarEventClick(Calendar.CalendarEventClickEvent<LocalDateTime> event) {
Screen visitEditor = screenBuilders.editor(Visit.class, this).editEntity((Visit) event.getEntity()).withOpenMode(OpenMode.DIALOG).build();
visitEditor.addAfterCloseListener(afterCloseEvent -> {
if (afterCloseEvent.closedWith(StandardOutcome.COMMIT)) {
getScreenData().loadAll();
}
});
visitEditor.show();
}
use of io.jmix.petclinic.entity.visit.Visit in project jmix-sneferu by mariodavid.
the class InteractionsTest method when_verifyIsPerformed_then_resultOfTheInteractionIsReturned.
@Test
void when_verifyIsPerformed_then_resultOfTheInteractionIsReturned(UiTestAPI uiTestAPI) {
// given:
final StandardEditorTestAPI<Visit, VisitEdit> openedScreen = uiTestAPI.openStandardEditor(Visit.class, VisitEdit.class);
// and:
assertThat(openedScreen.component(dateField("visitStartField"))).isNotNull();
// and:
final LocalDateTime startDate = LocalDateTime.of(2022, 1, 15, 6, 0);
// and:
openedScreen.interact(enter(dateField("visitStartField"), startDate));
// when:
final LocalDateTime enteredVisitStart = openedScreen.verify(entityValue("visitStart", LocalDateTime.class));
// then:
assertThat(enteredVisitStart).isEqualTo(startDate);
}
use of io.jmix.petclinic.entity.visit.Visit in project jmix-sneferu by mariodavid.
the class EditedEntityInteractionTest method when_interactionIsPerformed_then_editedEntityIsReturned.
@Test
void when_interactionIsPerformed_then_editedEntityIsReturned(UiTestAPI uiTestAPI) {
// given:
final Visit expectedVisit = dataManager.create(Visit.class);
// and:
StandardEditorTestAPI<Visit, VisitEdit> visitEdit = uiTestAPI.openStandardEditor(Visit.class, VisitEdit.class, expectedVisit);
// when:
final Visit actualVisitEntity = visitEdit.andThenGet(editedEntity());
// then:
assertThat(actualVisitEntity).isEqualTo(expectedVisit);
}
use of io.jmix.petclinic.entity.visit.Visit in project jmix-sneferu by mariodavid.
the class MyVisits method onStart.
@Subscribe("table.start")
protected void onStart(Action.ActionPerformedEvent event) {
final Visit visit = table.getSingleSelected();
if (visit.hasStarted()) {
petTreatmentWarningMessage("treatmentAlreadyStarted", visit.getPetName());
} else {
updateTreatmentTo(visit, VisitTreatmentStatus.IN_PROGRESS);
petTreatmentSuccessMessage("treatmentStarted", visit.getPetName());
}
}
Aggregations