From 17e618b6c370024a48d6c90428bf93cf50b837cf Mon Sep 17 00:00:00 2001 From: Sergey Vinogradov Date: Wed, 18 Oct 2023 13:32:26 +0300 Subject: [PATCH] do not assert the number of validation runs in eager mode --- ...DecimalFieldEagerBinderValidationPage.java | 3 --- .../BigDecimalFieldEagerValidationPage.java | 8 +------ ...igDecimalFieldEagerBinderValidationIT.java | 23 +++++++++++-------- .../BigDecimalFieldEagerValidationIT.java | 23 +++++++++++-------- 4 files changed, 27 insertions(+), 30 deletions(-) diff --git a/vaadin-text-field-flow-parent/vaadin-text-field-flow-integration-tests/src/main/java/com/vaadin/flow/component/textfield/tests/validation/BigDecimalFieldEagerBinderValidationPage.java b/vaadin-text-field-flow-parent/vaadin-text-field-flow-integration-tests/src/main/java/com/vaadin/flow/component/textfield/tests/validation/BigDecimalFieldEagerBinderValidationPage.java index 7b6d12a162e..b7d00daf95d 100644 --- a/vaadin-text-field-flow-parent/vaadin-text-field-flow-integration-tests/src/main/java/com/vaadin/flow/component/textfield/tests/validation/BigDecimalFieldEagerBinderValidationPage.java +++ b/vaadin-text-field-flow-parent/vaadin-text-field-flow-integration-tests/src/main/java/com/vaadin/flow/component/textfield/tests/validation/BigDecimalFieldEagerBinderValidationPage.java @@ -45,9 +45,6 @@ public BigDecimalFieldEagerBinderValidationPage() { Binder binder = new Binder<>(Bean.class); binder.forField(testField).bind("property"); - binder.addStatusChangeListener(event -> { - incrementServerValidationCounter(); - }); } protected BigDecimalField createTestField() { diff --git a/vaadin-text-field-flow-parent/vaadin-text-field-flow-integration-tests/src/main/java/com/vaadin/flow/component/textfield/tests/validation/BigDecimalFieldEagerValidationPage.java b/vaadin-text-field-flow-parent/vaadin-text-field-flow-integration-tests/src/main/java/com/vaadin/flow/component/textfield/tests/validation/BigDecimalFieldEagerValidationPage.java index c7e8775c787..373ff992cbc 100644 --- a/vaadin-text-field-flow-parent/vaadin-text-field-flow-integration-tests/src/main/java/com/vaadin/flow/component/textfield/tests/validation/BigDecimalFieldEagerValidationPage.java +++ b/vaadin-text-field-flow-parent/vaadin-text-field-flow-integration-tests/src/main/java/com/vaadin/flow/component/textfield/tests/validation/BigDecimalFieldEagerValidationPage.java @@ -29,12 +29,6 @@ public BigDecimalFieldEagerValidationPage() { } protected BigDecimalField createTestField() { - return new BigDecimalField() { - @Override - protected void validate() { - super.validate(); - incrementServerValidationCounter(); - } - }; + return new BigDecimalField(); } } diff --git a/vaadin-text-field-flow-parent/vaadin-text-field-flow-integration-tests/src/test/java/com/vaadin/flow/component/textfield/tests/validation/BigDecimalFieldEagerBinderValidationIT.java b/vaadin-text-field-flow-parent/vaadin-text-field-flow-integration-tests/src/test/java/com/vaadin/flow/component/textfield/tests/validation/BigDecimalFieldEagerBinderValidationIT.java index 273c264e7ad..068d5d6bf26 100644 --- a/vaadin-text-field-flow-parent/vaadin-text-field-flow-integration-tests/src/test/java/com/vaadin/flow/component/textfield/tests/validation/BigDecimalFieldEagerBinderValidationIT.java +++ b/vaadin-text-field-flow-parent/vaadin-text-field-flow-integration-tests/src/test/java/com/vaadin/flow/component/textfield/tests/validation/BigDecimalFieldEagerBinderValidationIT.java @@ -27,33 +27,36 @@ public class BigDecimalFieldEagerBinderValidationIT extends AbstractValidationIT { @Test public void enterChars_fieldValidatesOnEveryChar() { + // Entered: 2 + testField.sendKeys("2"); + assertServerValid(); + assertClientValid(); + + // Entered: + testField.sendKeys(Keys.BACK_SPACE); + assertServerValid(); + assertClientValid(); + } + + @Test + public void badInput_enterChars_fieldValidatesOnEveryChar() { // Entered: - testField.sendKeys("-"); - assertValidationCount(1); assertServerInvalid(); assertClientInvalid(); - resetValidationCount(); - // Entered: -2 testField.sendKeys("2"); - assertValidationCount(1); assertServerValid(); assertClientValid(); - resetValidationCount(); - // Entered: - testField.sendKeys(Keys.BACK_SPACE); - assertValidationCount(1); assertServerInvalid(); assertClientInvalid(); - resetValidationCount(); - // Entered: testField.sendKeys(Keys.BACK_SPACE); - assertValidationCount(1); assertServerValid(); assertClientValid(); } diff --git a/vaadin-text-field-flow-parent/vaadin-text-field-flow-integration-tests/src/test/java/com/vaadin/flow/component/textfield/tests/validation/BigDecimalFieldEagerValidationIT.java b/vaadin-text-field-flow-parent/vaadin-text-field-flow-integration-tests/src/test/java/com/vaadin/flow/component/textfield/tests/validation/BigDecimalFieldEagerValidationIT.java index 66247b1e1c7..1c0362c5c6c 100644 --- a/vaadin-text-field-flow-parent/vaadin-text-field-flow-integration-tests/src/test/java/com/vaadin/flow/component/textfield/tests/validation/BigDecimalFieldEagerValidationIT.java +++ b/vaadin-text-field-flow-parent/vaadin-text-field-flow-integration-tests/src/test/java/com/vaadin/flow/component/textfield/tests/validation/BigDecimalFieldEagerValidationIT.java @@ -27,33 +27,36 @@ public class BigDecimalFieldEagerValidationIT extends AbstractValidationIT { @Test public void enterChars_fieldValidatesOnEveryChar() { + // Entered: 2 + testField.sendKeys("2"); + assertServerValid(); + assertClientValid(); + + // Entered: + testField.sendKeys(Keys.BACK_SPACE); + assertServerValid(); + assertClientValid(); + } + + @Test + public void badInput_enterChars_fieldValidatesOnEveryChar() { // Entered: - testField.sendKeys("-"); - assertValidationCount(1); assertServerInvalid(); assertClientInvalid(); - resetValidationCount(); - // Entered: -2 testField.sendKeys("2"); - assertValidationCount(1); assertServerValid(); assertClientValid(); - resetValidationCount(); - // Entered: - testField.sendKeys(Keys.BACK_SPACE); - assertValidationCount(1); assertServerInvalid(); assertClientInvalid(); - resetValidationCount(); - // Entered: testField.sendKeys(Keys.BACK_SPACE); - assertValidationCount(1); assertServerValid(); assertClientValid(); }