-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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 <Form disableInvalidFormNotification>
to allow disabling notifications when the form is invalid
#9353
Conversation
Could you please add documentation and unit tests? |
added docs and a test to verify my changes ✌️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise it should be good. I'll just request @fzaninotto 's review to validate the new prop's name.
In any case, thanks!
await waitFor(() => { | ||
const notification = screen.queryByText('ra.message.invalid_form'); | ||
expect(notification).toBeNull(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test passes even without disableInvalidFormNotification
.
It is not always easy to check for the absence of something with Jest/RTL. You need to find an event to await for, that proves the form submission is complete, before attempting to check if the notification is there or not. You can try providing a jest.fn()
as onSuccess
to see if it helps, or try rendering the record and have RTL look for the changed value in the record.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback! 🙏
I updated the unit test so that I'm waiting for the validation message to be shown before checking the absence of the notification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Thanks! |
<Form disableInvalidFormNotification>
to allow disabling notifications when the form is invalid
This should close #9350