-
Notifications
You must be signed in to change notification settings - Fork 153
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
Attributes with unique values are not deterministic #247
Comments
Possible workaround for now is to mock the date for your test runner. Jest shown below:
Agreed it would be best to not use Date() to generate the IDs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
The usage of dates (
Date()
) makes snapshot testing more difficult.To Reproduce
Steps to reproduce the behavior:
yarn test
to seearia-controls="collapsible-content-1676553478193"
changing values on each runExpected behavior
Either make
id
s of collapsible elements required or generate unique values in a deterministic way independent from dates.An coming to mind would be to use a canonical value (or a hash, or a slug) of the
trigger
prop value by default rather than a date.Screenshots
Example errors given by test runner:
Additional context
The issue is not major, although the usage of dates for making HTML attribute values unique is not conventional for use cases that are not time sensitive.
The text was updated successfully, but these errors were encountered: