-
Notifications
You must be signed in to change notification settings - Fork 727
Added docs for getRoles and logRoles #155
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
Added docs for getRoles and logRoles #155
Conversation
These functions are proposed in dom-testing-library PR#285 testing-library/dom-testing-library#285
…ibrary-docs into pr/getroles-logroles-docs
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 your PR! I've added some comments and suggestions :)
|
||
const nav = document.createElement('nav') | ||
nav.innerHTML = ` | ||
<ul name="menu"> |
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.
Since name
isn't really a valid attribute for ul/li elements, I'd suggest removing it, so there's also less code to read in the example.
What do you think about it?
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.
Oops, I didn't realize name isn't valid for ul/li.
I think we should have some attribute in there to illustrate how it prints out the attributes. Thoughts?
Assuming the above, I'll probably change name="menu" to type="circle" on the ul and give the li elements a 'value' attribute in place of 'name'.
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.
Changed here: da985145
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.
Didn't know that until I checked right now, but type
attr on <ul>
elements is discouraged: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ul#attr-type
Also, looks like value
on <ul>
list items doesn't make much sense: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/li#attr-value
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.
Hmm.. swing and a miss, haha
nav->ul->li was nice because it is three distinct roles in a real world kind of situation.
Maybe it doesn't matter so much if the example illustrates how the output prints attributes, so there's always the option of getting rid of the attributes in the example (as your initial suggestion).
Though I guess we could always add class and/or id attributes to illustrate a more real-world output.
I'm gonna push one more commit this evening.
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.
;) no prob.
Maybe it doesn't matter so much if the example illustrates how the output prints attributes, so there's always the option of getting rid of the attributes in the example.
This still makes sense to me. The main goal of the example is to illustrate what a grouping-by-role looks like, not the attribute themselves.
Thanks for your work!
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.
Ok, I've pulled the attributes off the elements completely. I agree that it's the correct call. Sorry for the delay, distracted by work/holiday.
Co-Authored-By: Adrià Fontcuberta <[email protected]>
name is not a valid attribute for ul/li, changed to type/value respectively
…ibrary-docs into pr/getroles-logroles-docs
After discussion we decided to pull attributes off the example elements. testing-library#155
…ibrary-docs into pr/getroles-logroles-docs
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.
Super!
@all-contributors please add @michaellasky for docs |
I've put up a pull request to add @michaellasky! 🎉 |
* Added docs for getRoles and logRoles These functions are proposed in dom-testing-library PR#285 testing-library/dom-testing-library#285 * Updated logRoles output example to match new format * Changed import to @testing-library/dom Co-Authored-By: Adrià Fontcuberta <[email protected]> * Changed 'aria' to 'ARIA' in api-helpers * Gave example HTML ul/li elements valid attributes name is not a valid attribute for ul/li, changed to type/value respectively * Updated another instance wrong 'dom-testing-library' import * Added link to ARIA in HTML under getRoles * Updated getRoles and logRoles examples After discussion we decided to pull attributes off the example elements. testing-library/testing-library-docs#155
* Added docs for getRoles and logRoles These functions are proposed in dom-testing-library PR#285 testing-library/dom-testing-library#285 * Updated logRoles output example to match new format * Changed import to @testing-library/dom Co-Authored-By: Adrià Fontcuberta <[email protected]> * Changed 'aria' to 'ARIA' in api-helpers * Gave example HTML ul/li elements valid attributes name is not a valid attribute for ul/li, changed to type/value respectively * Updated another instance wrong 'dom-testing-library' import * Added link to ARIA in HTML under getRoles * Updated getRoles and logRoles examples After discussion we decided to pull attributes off the example elements. testing-library/testing-library-docs#155
These functions are proposed in dom-testing-library PR#285