Skip to content

Commit

Permalink
do not assert the number of validation runs in eager mode
Browse files Browse the repository at this point in the history
  • Loading branch information
vursen committed Oct 18, 2023
1 parent 74b2907 commit 17e618b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ public BigDecimalFieldEagerBinderValidationPage() {

Binder<Bean> binder = new Binder<>(Bean.class);
binder.forField(testField).bind("property");
binder.addStatusChangeListener(event -> {
incrementServerValidationCounter();
});
}

protected BigDecimalField createTestField() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ public BigDecimalFieldEagerValidationPage() {
}

protected BigDecimalField createTestField() {
return new BigDecimalField() {
@Override
protected void validate() {
super.validate();
incrementServerValidationCounter();
}
};
return new BigDecimalField();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,36 @@ public class BigDecimalFieldEagerBinderValidationIT
extends AbstractValidationIT<BigDecimalFieldElement> {
@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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,36 @@ public class BigDecimalFieldEagerValidationIT
extends AbstractValidationIT<BigDecimalFieldElement> {
@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();
}
Expand Down

0 comments on commit 17e618b

Please sign in to comment.