-
Notifications
You must be signed in to change notification settings - Fork 52
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
Is it possible to bypass the camel-casing of properties? #130
Comments
Potentially related to #9. |
For test IDs and other custom attributes that you don't want to be munged, you can prefix (d/button {:data-testid "foo-button"} "Foo") See helix/src/helix/impl/props.cljc Line 11 in 6d86748
aria- and -- attributes.
Hope that helps! |
In our case, the trouble is that the tests are expecting certain elements to be identified with the property |
Maybe a silly question, but could you change the tests? AFAIK best practices for DOM testing is to use The usage of data attributes for this is to ensure that future changes to the DOM spec don't end up changing the behavior of the elements you've attached the attributes to. See https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes I can think about other fixes for this, but in general it will behoove you to store and lookup this type of information in |
Thanks for the information, this is helpful! We would prefer to avoid renaming the attributes, since we are already using the non- We might also be able to work around this by using non-native elements (e.g. MUI Box), since the properties are passed through unchanged for those. |
ebe00d0 allows string keys to be used to pass props to DOM elements verbatim. E.g. (d/button {"logical-id" "foo"} "Foo") This will go out in the next release. You're welcome to use it via git deps for now. However, again, I would strongly encourage you to migrate your tests to use Either way, thanks for the report! I'll close this for now. If you do try out the string keys functionality and you find any bugs, please open another issue. |
That all sounds good - thanks for the fast response! |
Hello! Thank you for Helix, it's fantastic. 🙌
I'm trying to add a custom, kebab-cased
logical-id
property on various elements in our UI for testing purposes, but I discovered that if the element is a native one, Helix automatically converts the names of all of its properties into camel-case.Is it possible to opt out of this behavior, at least for certain properties, or on a per-element basis? Or do you have any other thoughts on how to address this? I cannot change the name of the property, as we are already using kebab-case in our tests.
The text was updated successfully, but these errors were encountered: