Skip to content

test: verify invalid is set appropriately when committing values - #4223

Merged
web-padawan merged 1 commit into
masterfrom
test/date-picker/tests-for-invalid-state
Jul 18, 2022
Merged

web-padawan merged 1 commit into
masterfrom
test/date-picker/tests-for-invalid-state

Conversation

@vursen

@vursen vursen commented Jul 16, 2022 •

Copy link
Copy Markdown
Contributor

Description

This PR improves test coverage of date-picker by making some of its validation tests verify that the invalid property is updated appropriately after committing values rather than just that checkValidity() returns an expected result. In other words, the new version of tests ensures that the validation happens at the correct moment that is after the entered value has been committed (= the value property has been updated) and thus ensures that the validation uses the new value.

A follow-up to #4163

Type of change

  • Internal

Checklist

  • I have read the contribution guide: https://vaadin.com/docs-beta/latest/guide/contributing/overview/
  • I have added a description following the guideline.
  • The issue is created in the corresponding repository and I have referenced it.
  • I have added tests to ensure my change is effective and works as intended.
  • New and existing tests are passing locally with my change.
  • I have performed self-review and corrected misspellings.

@vursen vursen changed the title test: verify the invalid state is set appropriately when committing values test: verify invalid is set appropriately when committing values Jul 16, 2022
@sonarqubecloud

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 3 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication


it('should fail validation without value', () => {
expect(datePicker.checkValidity()).to.be.false;
expect(datePicker.validate()).to.be.false;

@vursen vursen Jul 16, 2022 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I added these validate() assertions in #4163 but now I think that they don't actually make much sense since the component doesn't override the validate() method, so asserting checkValidity() should be enough.

@vursen
vursen requested a review from web-padawan July 18, 2022 06:54
@web-padawan
web-padawan merged commit c509c1f into master Jul 18, 2022
@web-padawan
web-padawan deleted the test/date-picker/tests-for-invalid-state branch July 18, 2022 07:23
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.

2 participants