-
Notifications
You must be signed in to change notification settings - Fork 467
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
fix(queryAllByAttribute): query input
elements with dynamically assigned value
#166
fix(queryAllByAttribute): query input
elements with dynamically assigned value
#166
Conversation
closes #158 |
Thoughts? @alexkrolick |
I don't like this. I might be inclined to add a new query called What do you think @alexkrolick? |
My two cents: if the goal of this library is to operate like a user viewing the page with eyes or screen reader, the |
True. We do have |
The only reason for querying by attribute is because the attributes are proxies to what the browser displays to the user (there's no good way to query the browser render tree itself and get annotated positioned semantic items out of it). |
Maybe the queries for select value and textarea could be combined with the input query - I think this would work for most use cases because the value property and the DOM attribute are initially in sync when an element is created, and when they are different, the property is what is visually displayed. |
Ok, I'm in favor of that. Let's go ahead and add it and we can add a deprecation message to the README for the Thanks for the PR anyway @eunjae-lee! Would you be interested in making a PR to add a |
Thanks all for the feedbacks. I really love how this conclusion has been made! @kentcdodds I'm still interested in contributing on this. To make sure, |
I think the property should be sufficient. |
Hmm. Although value property hasn't been assigned to the element, if it has DOM attribute, end-user will see it on screen. Shouldn't we get elements like this? |
The value property is initially set to the same thing as the attribute, unless I'm interpreting this wrong (check console) https://codepen.io/alexkrolick/pen/NELEKE?editors=1011 Note that getByCurrentValue should also do what getBySelectText does now, so the same interface can be used for user input. |
@alexkrolick oh you're right. My bad. I'll bring a draft for |
What: The implementation of
queryAllByAttribute
has been changed so that it can successfully queryinput
elements with dynamically assignedvalue
.Why: When
value
is dynamically assigned to aninput
, not by an attribute on HTML,queryAllByAttribute
won't query that element at the moment.How:
queryAllByAttribute
behaves differently when itsattribute
is equal to"value"
. I'm not sure if this is the best way to implement this. Feedbacks are welcomed.Checklist: