Skip to content

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

Merged

Conversation

michaellasky
Copy link
Contributor

These functions are proposed in dom-testing-library PR#285

@michaellasky michaellasky marked this pull request as ready for review June 24, 2019 16:26
Copy link
Member

@afontcu afontcu left a 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">
Copy link
Member

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?

Copy link
Contributor Author

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'.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed here: da985145

Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Member

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!

Copy link
Contributor Author

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.

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super!

@kentcdodds kentcdodds merged commit 5b3e79e into testing-library:master Jul 7, 2019
@kentcdodds
Copy link
Member

@all-contributors please add @michaellasky for docs

@allcontributors
Copy link
Contributor

@kentcdodds

I've put up a pull request to add @michaellasky! 🎉

superT999 added a commit to superT999/testing-library-docs that referenced this pull request Feb 13, 2023
* 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
web3gru pushed a commit to web3gru/testing-library-docs that referenced this pull request May 13, 2023
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants