Search in sources :

Example 1 with HasListDataView

use of com.vaadin.flow.data.provider.HasListDataView in project linkki by linkki-framework.

the class AvailableValuesAspectDefinitionTest method testHandleNullItems.

@Test
void testHandleNullItems() {
    AvailableValuesAspectDefinition<HasListDataView<Object, ?>> availableValuesAspectDefinition = new AvailableValuesAspectDefinition<>(AvailableValuesType.DYNAMIC, NOP);
    @SuppressWarnings("unchecked") List<Object> items = mock(List.class);
    @SuppressWarnings("unchecked") ComboBox<Object> component = mock(ComboBox.class);
    availableValuesAspectDefinition.handleNullItems(new NoLabelComponentWrapper(component, WrapperType.FIELD), items);
    verifyNoMoreInteractions(component, items);
}
Also used : HasListDataView(com.vaadin.flow.data.provider.HasListDataView) NoLabelComponentWrapper(org.linkki.core.ui.wrapper.NoLabelComponentWrapper) Test(org.junit.jupiter.api.Test)

Example 2 with HasListDataView

use of com.vaadin.flow.data.provider.HasListDataView in project linkki by linkki-framework.

the class AvailableValuesAspectDefinitionTest method testSetDataProvider.

@Test
void testSetDataProvider() {
    @SuppressWarnings("unchecked") BiConsumer<HasListDataView<Object, ?>, List<Object>> dataProviderSetter = mock(BiConsumer.class);
    AvailableValuesAspectDefinition<HasListDataView<Object, ?>> availableValuesAspectDefinition = new AvailableValuesAspectDefinition<>(AvailableValuesType.DYNAMIC, dataProviderSetter);
    List<Object> data = new ArrayList<>();
    ComboBox<Object> component = new ComboBox<>();
    availableValuesAspectDefinition.setDataProvider(new NoLabelComponentWrapper(component), data);
    verify(dataProviderSetter).accept(component, data);
}
Also used : HasListDataView(com.vaadin.flow.data.provider.HasListDataView) ComboBox(com.vaadin.flow.component.combobox.ComboBox) NoLabelComponentWrapper(org.linkki.core.ui.wrapper.NoLabelComponentWrapper) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) Test(org.junit.jupiter.api.Test)

Example 3 with HasListDataView

use of com.vaadin.flow.data.provider.HasListDataView in project linkki by linkki-framework.

the class GenericAvailableValuesAspectDefinitionTest method testSetDataProvider_HasDataProvider.

@SuppressWarnings("unchecked")
@Test
public void testSetDataProvider_HasDataProvider() {
    GenericAvailableValuesAspectDefinition hasItemsAvailableValuesAspectDefinition = new GenericAvailableValuesAspectDefinition(AvailableValuesType.DYNAMIC);
    List<Object> list = new ArrayList<>();
    Component component = spy(new TestHasListDataView());
    ComponentWrapper componentWrapper = new NoLabelComponentWrapper(component, WrapperType.FIELD);
    hasItemsAvailableValuesAspectDefinition.setDataProvider(componentWrapper, list);
    verify((HasListDataView<Object, ?>) component).setItems(list);
}
Also used : HasListDataView(com.vaadin.flow.data.provider.HasListDataView) NoLabelComponentWrapper(org.linkki.core.ui.wrapper.NoLabelComponentWrapper) ArrayList(java.util.ArrayList) Component(com.vaadin.flow.component.Component) ComponentWrapper(org.linkki.core.binding.wrapper.ComponentWrapper) NoLabelComponentWrapper(org.linkki.core.ui.wrapper.NoLabelComponentWrapper) Test(org.junit.jupiter.api.Test)

Aggregations

HasListDataView (com.vaadin.flow.data.provider.HasListDataView)3 Test (org.junit.jupiter.api.Test)3 NoLabelComponentWrapper (org.linkki.core.ui.wrapper.NoLabelComponentWrapper)3 ArrayList (java.util.ArrayList)2 Component (com.vaadin.flow.component.Component)1 ComboBox (com.vaadin.flow.component.combobox.ComboBox)1 List (java.util.List)1 ComponentWrapper (org.linkki.core.binding.wrapper.ComponentWrapper)1