Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add __forceCheckValidity and test #452

Merged
merged 4 commits into from
Feb 10, 2020
Merged

Add __forceCheckValidity and test #452

merged 4 commits into from
Feb 10, 2020

Conversation

yuriy-fix
Copy link
Contributor

Connected to vaadin/vaadin-date-picker#696.

In many cases the component containing text-field (i.e.) faces a problem with the validation of internal input, because checkValidity of the text-field returns false based on the previous value of the invalid property. (return !this.invalid;) There wasn’t any simple way of making the field checkValidity without setting validation constraints.

This PR adds this possibility.

Copy link
Member

@web-padawan web-padawan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙈 LGTM

Copy link
Member

@web-padawan web-padawan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update sinonjs to fix the bower installation.

@yuriy-fix
Copy link
Contributor Author

There is also possibility to go with:

checkValidity() {
  if (this.required || this.pattern || this.maxlength || this.minlength || this.__checkValidityForced) {
    this.__checkValidityForced = false;
    return this.inputElement.checkValidity();
  } else {
    return !this.invalid;
  }
}

__forceCheckValidity() {
  this.__checkValidityForced = true;
}

@yuriy-fix yuriy-fix merged commit 6f49bf7 into master Feb 10, 2020
@web-padawan web-padawan deleted the force-check branch February 10, 2020 12:49
yuriy-fix added a commit that referenced this pull request Feb 10, 2020
* Add __forceCheckValidity and test

* chore: add explicit sinonjs dependency

* Add note

* Update screenshots
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants