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
logRoles does not print hidden elements #1201
Comments
Hey, |
Hey @cupojoe, @MatanBobi should we perhaps change that behavior or add an option to include these elements in the output? |
I think that printing out |
@MatanBobi Well, I think it's both. On one hand, the function takes a parameter that I had to dig through the source code to understand. It should pop in the autocomplete in the IDE and be in the docs. Unless I am missing something (which is possible) and in that case I apologize. On the other hand, the usefulness of a debug tool is to dump information that the internal mechanics are using in its behavior. I think it is relevant to show the role (even if it is generic) if that role is being used to match a result from a query. I want to know why something was matched (or not matched). Worst case scenario the debug tool should let me enable more information if I want it, not make those decisions for me, right? If I need more data to debug I should be able to get it. |
@cupojoe if you mean the
That's why, adding |
That is great news that it was merged! Thank you @naorpeled |
+1 |
@testing-library/react
version: 14.0.0Relevant code or config:
What you did:
I was trying to
logRoles
for a DOM tree with hidden elements. Failed to see the elements show in the roles list.What happened:
Logging roles for hidden elements produces an empty log.
Reproduction:
logRoles
screen.debug
Problem description:
If you log an element you found using
{ hidden: true }
,logRoles
will not print it. Similarly won't print hidden elements in a DOM tree you pass in. This is the opposite of what I would expect from this tool. I want to know why something may be failing to query, so I want to see everything in the tree.The
logRole
function does take a{ hidden }
parameter and by default is set tofalse
, however the function signature in Typescript does not accept a second parameter.Suggested solution:
A useful thing would be that hidden was on by default, the function signature would be updated to take the second parameter, and that elements logged that are hidden, report so in the pretty role output.
The text was updated successfully, but these errors were encountered: