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 option to display invalid constraints on form validation in console #3583

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SamuelWei
Copy link

@SamuelWei SamuelWei commented Jul 27, 2023

Since #3249 a form must be valid to be submitted.

This PR intends to add a new config option reportInvalidConstraintsToConsole to help developers find error in their tests.
In a regular web browser the browser informs the user on the failed form fields.
This option should bring this feature to jsdom to help developers indentify which fields are causing their form to not be submitted during testing.


This PR stills needs some work by someone who is familar with the dev. of jsdom. The config option is not correctly passed down to the HTMLFormElement-impl.js file yet. Softwaretests are still missing.

Feel free to edit and modify everything!

@domenic
Copy link
Member

domenic commented Jul 27, 2023

I don't think we want to add options to jsdom to make it behave less like a standards-compliant browser.

I suggest you make your tests pass the same way you would make them pass in a real browser. For example, by setting the novalidate attribute on the form during the test.

@domenic domenic closed this Jul 27, 2023
@domenic
Copy link
Member

domenic commented Jul 27, 2023

I'm very sorry. I did not properly read the PR. Reporting to the console is a good idea. In fact I think we should do it by default.

@domenic domenic reopened this Jul 27, 2023
@SamuelWei
Copy link
Author

@domenic Will you finish implementing the new function?

I don't know how to pass the config variable correctly to the HTMLFormElement-impl.js - otherwise you can also help me how to do that.

@domenic
Copy link
Member

domenic commented Jul 27, 2023

No, sorry, I don't have time to work on this myself.

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.

None yet

2 participants