-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[test] Use describeTreeView
for keyboard navigation tests on disabled items
#13184
[test] Use describeTreeView
for keyboard navigation tests on disabled items
#13184
Conversation
… items
@@ -32,7 +32,27 @@ export const getPreviousNavigableItem = ( | |||
return itemMeta.parentId; | |||
} | |||
|
|||
let currentItemId: string = siblings[itemIndex - 1]; | |||
// Finds the previous navigable sibling. |
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.
If the previous sibling was disabled it was all broken
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.
Nice fix. 👍
These are situations where you appreciate the effort put into writing tests. 👏 🎉
Deploy preview: https://deploy-preview-13184--material-ui-x.netlify.app/ |
@@ -22,7 +22,7 @@ const getLastNavigableItemInArray = ( | |||
export const getPreviousNavigableItem = ( |
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.
Side note: Would be awesome if we could strongly battle test those methods to avoid bugs
Because we probably don't want 30 tests on ArrowDown
, 30 tests on ArrowUp
etc... to check edge-cases of this method.
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.
LGTM. 👍
The tests seem that they could be abstracted, but I'm not sure if it's necessary and would bring enough benefits doing that. 🤔
@@ -32,7 +32,27 @@ export const getPreviousNavigableItem = ( | |||
return itemMeta.parentId; | |||
} | |||
|
|||
let currentItemId: string = siblings[itemIndex - 1]; | |||
// Finds the previous navigable sibling. |
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.
Nice fix. 👍
These are situations where you appreciate the effort put into writing tests. 👏 🎉
Could you explain what you mean by abstracted here? |
I meant that it seems like a lot of those tests are doing almost the same thing, testing what happens when you click ArrowUp or ArrowDown. |
Oh you meant maybe something like we do on the fields with a I propose we stick with the raw tests like today, but instead of adding dozens of new ones to handle edge cases, we test the utility methods, and those tests will be shorter. |
Yes, that's what I had in mind. 👌
Completely agree on this one, especially for now. 👍 |
Part of #12433
I added a few tests and did a bug fix