|
|
@@ -811,6 +811,25 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> { |
|
|
|
String.valueOf(item.getAge()), ageField.getValue()); |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
public void remove_binding_fromFieldValueChangeListener() { |
|
|
|
// Add listener before bind to make sure it will be executed first. |
|
|
|
nameField.addValueChangeListener(e -> { |
|
|
|
if (e.getValue() == "REMOVE") { |
|
|
|
binder.removeBinding(nameField); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
binder.bind(nameField, Person::getFirstName, Person::setFirstName); |
|
|
|
|
|
|
|
binder.setBean(item); |
|
|
|
|
|
|
|
nameField.setValue("REMOVE"); |
|
|
|
|
|
|
|
// Removed binding should not update bean. |
|
|
|
assertNotEquals("REMOVE", item.getFirstName()); |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
public void beanvalidation_two_fields_not_equal() { |
|
|
|
TextField lastNameField = new TextField(); |