use of com.vaadin.flow.component.formlayout.FormLayout in project flow-components by vaadin.
the class FormLayoutView method createFormLayoutWithItems.
private void createFormLayoutWithItems() {
FormLayout layoutWithFormItems = new FormLayout();
TextField firstName = new TextField();
firstName.setPlaceholder("John");
layoutWithFormItems.addFormItem(firstName, "First name");
TextField lastName = new TextField();
lastName.setPlaceholder("Doe");
layoutWithFormItems.addFormItem(lastName, "Last name");
addCard("A form layout with fields wrapped in items", layoutWithFormItems);
}
use of com.vaadin.flow.component.formlayout.FormLayout in project flow-components by vaadin.
the class FormLayoutTest method verifyColspanElement.
@Test
public void verifyColspanElement() {
FormLayout layout = new FormLayout();
// using layouts as components to avoid importing dependencies.
// verifying the colspan is correctly set in the element itself
FormLayout comp1 = new FormLayout();
layout.add(comp1, 2);
String strColspan = comp1.getElement().getAttribute("colspan");
Assert.assertEquals(Integer.parseInt(strColspan), 2);
}
use of com.vaadin.flow.component.formlayout.FormLayout in project flow-components by vaadin.
the class FormLayoutTest method verifyColspanCodeBehaviour.
@Test
public void verifyColspanCodeBehaviour() {
FormLayout layout = new FormLayout();
// using layouts as components to avoid importing dependencies.
// verifying normal use cases
FormLayout comp1 = new FormLayout();
layout.add(comp1, 2);
Assert.assertEquals(layout.getColspan(comp1), 2);
layout.setColspan(comp1, 1);
Assert.assertEquals(layout.getColspan(comp1), 1);
// verifying it correctly sets it to 1 if an number lower than 1 is
// supplied
FormLayout comp2 = new FormLayout();
layout.add(comp2, -1);
Assert.assertEquals(layout.getColspan(comp2), 1);
// verifying it correctly gets 1 if invalid colspans are supplied
// outside the API
FormLayout compInvalid = new FormLayout();
layout.add(compInvalid);
compInvalid.getElement().setAttribute("colspan", "qsd4hdsj%f");
Assert.assertEquals(layout.getColspan(compInvalid), 1);
// verifying it correctly gets 1 if no colspan was set.
FormLayout compUnset = new FormLayout();
layout.add(compUnset);
Assert.assertEquals(layout.getColspan(compUnset), 1);
}
use of com.vaadin.flow.component.formlayout.FormLayout in project flow-components by vaadin.
the class FormLayoutTest method getResponsiveSteps_noInitialSteps_emptyListIsReturned.
@Test
public void getResponsiveSteps_noInitialSteps_emptyListIsReturned() {
FormLayout layout = new FormLayout();
Assert.assertTrue(layout.getResponsiveSteps().isEmpty());
}
use of com.vaadin.flow.component.formlayout.FormLayout in project flow-components by vaadin.
the class FormLayoutTest method create_FormLayout.
@Test
public void create_FormLayout() {
// Just testing that creating form layout actually compiles and doesn't
// throw. Test is on purpose, so that the implementation not
// accidentally removed.
FormLayout formLayout = new FormLayout();
formLayout.addClickListener(event -> {
});
}
Aggregations