use of de.diedavids.sneferu.components.descriptor.DataGridComponentDescriptor in project jmix-sneferu by mariodavid.
the class SelectInListInteractionTest method when_multipleSelectionIsTriedWithSingleSelectionTable_then_exceptionIsThrown.
@Test
void when_multipleSelectionIsTriedWithSingleSelectionTable_then_exceptionIsThrown(UiTestAPI uiTestAPI) {
// given:
storeVet("Elm");
storeVet("Rowan");
storeVet("Sycamore");
// and:
final Veterinarian oak = storeVet("Oak");
final Veterinarian juniper = storeVet("Juniper");
final Veterinarian birch = storeVet("Birch");
// and:
final StandardLookupTestAPI<Veterinarian, VeterinarianBrowse> openedScreen = uiTestAPI.openStandardLookup(Veterinarian.class, VeterinarianBrowse.class);
final DataGridComponentDescriptor dataGrid = dataGrid("veterinariansTable");
assertThat(openedScreen.rawComponent(dataGrid).isMultiSelect()).isFalse();
// when:
final IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> openedScreen.interact(selectInList(dataGrid, Lists.list(birch, oak, juniper))));
// then:
assertThat(exception.getMessage()).isEqualTo("Cannot select multiple values for component with multiselect='false'");
}
use of de.diedavids.sneferu.components.descriptor.DataGridComponentDescriptor in project jmix-sneferu by mariodavid.
the class SelectInListInteractionTest method when_interactionIsPerformedWithSingleSelection_then_valueIsSet.
@Test
void when_interactionIsPerformedWithSingleSelection_then_valueIsSet(UiTestAPI uiTestAPI) {
// given:
storeVet("Oak");
storeVet("Elm");
storeVet("Juniper");
storeVet("Rowan");
storeVet("Sycamore");
// and:
final Veterinarian birch = storeVet("Birch");
// and:
final StandardLookupTestAPI<Veterinarian, VeterinarianBrowse> openedScreen = uiTestAPI.openStandardLookup(Veterinarian.class, VeterinarianBrowse.class);
final DataGridComponentDescriptor dataGrid = dataGrid("veterinariansTable");
assertThat(openedScreen.rawComponent(dataGrid).isMultiSelect()).isFalse();
// when:
openedScreen.interact(selectInList(dataGrid, birch));
// then:
final Veterinarian selectedVetInTable = (Veterinarian) openedScreen.rawComponent(dataGrid).getSingleSelected();
// and:
assertThat(selectedVetInTable).isEqualTo(birch);
}
Aggregations