use of com.vaadin.flow.data.binder.testcomponents.TestLabel in project flow by vaadin.
the class BinderValidationStatusTest method bindingWithStatusLabel_labelIsUpdatedAccordingStatus.
@Test
public void bindingWithStatusLabel_labelIsUpdatedAccordingStatus() {
TestLabel label = new TestLabel();
Binding<Person, String> binding = binder.forField(nameField).withValidator(notEmpty).withStatusLabel(label).bind(Person::getFirstName, Person::setFirstName);
nameField.setValue("");
// First validation fails => should be event with ERROR status and
// message
binding.validate();
assertVisible(label, true);
Assert.assertEquals(EMPTY_ERROR_MESSAGE, label.getText());
nameField.setValue("foo");
// Second validation succeeds => should be event with OK status and
// no message
binding.validate();
assertVisible(label, false);
Assert.assertEquals("", label.getText());
}
use of com.vaadin.flow.data.binder.testcomponents.TestLabel in project flow by vaadin.
the class ReadOnlyHasValueTest method setup.
@Before
public void setup() {
label = new TestLabel();
hasValue = new ReadOnlyHasValue<>(label::setText);
}
use of com.vaadin.flow.data.binder.testcomponents.TestLabel in project flow by vaadin.
the class ValidatorTestBase method setUp.
@Before
public void setUp() {
ui = new UI() {
@Override
public Locale getLocale() {
return locale;
}
};
UI.setCurrent(ui);
localeContext = new TestLabel();
}
Aggregations