use of com.vaadin.flow.data.binder.testcomponents.TestLabel in project flow by vaadin.
the class BinderValidationStatusTest method bindingWithStatusLabel_addAfterBound.
@Test(expected = IllegalStateException.class)
public void bindingWithStatusLabel_addAfterBound() {
TestLabel label = new TestLabel();
BindingBuilder<Person, String> binding = binder.forField(nameField).withValidator(notEmpty);
binding.bind(Person::getFirstName, Person::setFirstName);
binding.withStatusLabel(label);
}
use of com.vaadin.flow.data.binder.testcomponents.TestLabel in project flow by vaadin.
the class BinderValidationStatusTest method binderWithStatusLabel_addAfterBound.
@Test(expected = IllegalStateException.class)
public void binderWithStatusLabel_addAfterBound() {
TestLabel label = new TestLabel();
BindingBuilder<Person, String> binding = binder.forField(nameField).withValidator(notEmpty);
binding.bind(Person::getFirstName, Person::setFirstName);
binding.withStatusLabel(label);
}
use of com.vaadin.flow.data.binder.testcomponents.TestLabel in project flow by vaadin.
the class BinderValidationStatusTest method bindingWithStatusLabel_defaultStatusHandlerIsReplaced.
@Test
public void bindingWithStatusLabel_defaultStatusHandlerIsReplaced() {
TestLabel label = new TestLabel();
Binding<Person, String> binding = binder.forField(nameField).withValidator(notEmpty).withStatusLabel(label).bind(Person::getFirstName, Person::setFirstName);
Assert.assertNull(componentErrors.get(nameField));
nameField.setValue("");
// First validation fails => should be event with ERROR status and
// message
binding.validate();
// default behavior should update component error for the nameField
Assert.assertNull(componentErrors.get(nameField));
}
use of com.vaadin.flow.data.binder.testcomponents.TestLabel in project flow by vaadin.
the class BinderValidationStatusTest method bindingWithStatusHandler_setAfterLabel.
@Test(expected = IllegalStateException.class)
public void bindingWithStatusHandler_setAfterLabel() {
TestLabel label = new TestLabel();
BindingBuilder<Person, String> binding = binder.forField(nameField);
binding.withStatusLabel(label);
binding.withValidationStatusHandler(NOOP);
}
use of com.vaadin.flow.data.binder.testcomponents.TestLabel in project flow by vaadin.
the class BinderValidationStatusTest method binderWithStatusHandler_setAfterLabel.
@Test(expected = IllegalStateException.class)
public void binderWithStatusHandler_setAfterLabel() {
TestLabel label = new TestLabel();
BindingBuilder<Person, String> binding = binder.forField(nameField);
binding.bind(Person::getFirstName, Person::setFirstName);
binder.setStatusLabel(label);
binder.setValidationStatusHandler(event -> {
});
}
Aggregations