Search in sources :

Example 31 with TextField

use of com.vaadin.flow.component.textfield.TextField in project flow-components by vaadin.

the class ValueChangeModePage method initView.

private void initView() {
    message = new Div();
    message.setId("message");
    add(message);
    Stream.of(new TextField(), new TextArea(), new PasswordField(), new NumberField(), new EmailField(), new IntegerField(), new BigDecimalField()).forEach(this::setupTestComponent);
}
Also used : Div(com.vaadin.flow.component.html.Div) TextArea(com.vaadin.flow.component.textfield.TextArea) EmailField(com.vaadin.flow.component.textfield.EmailField) TextField(com.vaadin.flow.component.textfield.TextField) IntegerField(com.vaadin.flow.component.textfield.IntegerField) PasswordField(com.vaadin.flow.component.textfield.PasswordField) NumberField(com.vaadin.flow.component.textfield.NumberField) BigDecimalField(com.vaadin.flow.component.textfield.BigDecimalField)

Example 32 with TextField

use of com.vaadin.flow.component.textfield.TextField in project flow-components by vaadin.

the class HasLabelTest method textField.

@Test
public void textField() {
    TextField c = new TextField();
    Assert.assertTrue(c instanceof HasLabel);
}
Also used : HasLabel(com.vaadin.flow.component.HasLabel) TextField(com.vaadin.flow.component.textfield.TextField) Test(org.junit.Test)

Example 33 with TextField

use of com.vaadin.flow.component.textfield.TextField in project flow-components by vaadin.

the class PrefixSuffixTest method setSuffix_replacesSuffix.

@Test
public void setSuffix_replacesSuffix() {
    TextField field = new TextField();
    Assert.assertNull("There should be no suffix component by default", field.getSuffixComponent());
    setAndAssertSuffix(field, new Span());
    setAndAssertSuffix(field, new H1());
}
Also used : TextField(com.vaadin.flow.component.textfield.TextField) H1(com.vaadin.flow.component.html.H1) Span(com.vaadin.flow.component.html.Span) Test(org.junit.Test)

Example 34 with TextField

use of com.vaadin.flow.component.textfield.TextField in project flow-components by vaadin.

the class PrefixSuffixTest method setPrefix_replacesPrefix.

@Test
public void setPrefix_replacesPrefix() {
    TextField field = new TextField();
    Assert.assertNull("There should be no prefix component by default", field.getPrefixComponent());
    setAndAssertPrefix(field, new Span());
    setAndAssertPrefix(field, new H1());
}
Also used : TextField(com.vaadin.flow.component.textfield.TextField) H1(com.vaadin.flow.component.html.H1) Span(com.vaadin.flow.component.html.Span) Test(org.junit.Test)

Example 35 with TextField

use of com.vaadin.flow.component.textfield.TextField in project flow-components by vaadin.

the class PrefixSuffixTest method setSuffix_setSuffixNull_suffixRemoved.

@Test
public void setSuffix_setSuffixNull_suffixRemoved() {
    TextField field = new TextField();
    field.setSuffixComponent(new Span());
    field.setSuffixComponent(null);
    Assert.assertNull(field.getSuffixComponent());
    Assert.assertEquals("Setting suffix component to null should remove all children in the suffix-slot", 0, getNumOfChildrenInSlot(field, "suffix"));
}
Also used : TextField(com.vaadin.flow.component.textfield.TextField) Span(com.vaadin.flow.component.html.Span) Test(org.junit.Test)

Aggregations

TextField (com.vaadin.flow.component.textfield.TextField)227 Test (org.junit.jupiter.api.Test)61 Button (com.vaadin.flow.component.button.Button)54 Div (com.vaadin.flow.component.html.Div)38 HorizontalLayout (com.vaadin.flow.component.orderedlayout.HorizontalLayout)32 FormLayout (com.vaadin.flow.component.formlayout.FormLayout)29 Binder (com.vaadin.flow.data.binder.Binder)29 GeneratedVaadinTextField (com.vaadin.flow.component.textfield.GeneratedVaadinTextField)28 Element (com.vaadin.flow.dom.Element)26 VerticalLayout (com.vaadin.flow.component.orderedlayout.VerticalLayout)23 Route (com.vaadin.flow.router.Route)21 Component (com.vaadin.flow.component.Component)16 Checkbox (com.vaadin.flow.component.checkbox.Checkbox)15 BinderCrudEditor (com.vaadin.flow.component.crud.BinderCrudEditor)15 Grid (com.vaadin.flow.component.grid.Grid)15 Span (com.vaadin.flow.component.html.Span)15 List (java.util.List)15 EmailField (com.vaadin.flow.component.textfield.EmailField)14 TextArea (com.vaadin.flow.component.textfield.TextArea)14 Test (org.junit.Test)14