-
-
Notifications
You must be signed in to change notification settings - Fork 356
[LiveComponent] consider data-value attribute #203
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
[LiveComponent] consider data-value attribute #203
Conversation
Hey @WhiteRabbitDE! My apologies for the slow response on this! I like this. Could you (A) add a test and (B) update the documentation? The test would be inside Thanks! |
Hallo @weaverryan , i just tried to add a test but i have little experience with Jest and how it is used here. Im not sure how to add my case in a proper way. Can you give me a small hint please? |
Absolutely :). Here are a few ideas to get you started: A) This is the template used in the test - https://github.com/symfony/ux/blob/2.x/src/LiveComponent/assets/test/controller/model.test.ts#L19-L32 - it is a little template with just a B) Duplicate this test and update its description to make sense - https://github.com/symfony/ux/blob/2.x/src/LiveComponent/assets/test/controller/model.test.ts#L39-L62 C) Inside that test, instead of typing into the input (that's the D) The last bit you'll need to change is the fetchMock - https://github.com/symfony/ux/blob/2.x/src/LiveComponent/assets/test/controller/model.test.ts#L54-L55 - change both To run the test, move into Let me know if this helps! |
Hey @weaverryan , I hope i can use that new knowledge in future PRs :-) |
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.
Beautiful ❤️
|
||
If an element has _both_ `data-value` and `value` attributes, the | ||
`data-value` attribute takes precedence. | ||
|
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.
Perfectly explained!
Thank you Jan! |
Allow to set the value using data-value. This can be handy if the model is updated from an <a> or <button> to set it to a fixed value for example.