-
Notifications
You must be signed in to change notification settings - Fork 841
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
[EuiDataGrid] Add remaining unit tests for focus logic #5698
Conversation
+ remove unnecessary role=gridcell check - after inspecting our DOM, that role attr is set on the topmost cell wrapper but `data-datagrid-cellcontent` is set on a div below that, so there's no way the parent cell should be inside the cell content + swap dataset check for hasAttribute - for some reason Jest/JSDOM was failing to register dataset, but hasAttribute works and should be equivalent
+ change unmount_enzyme helper to run after each file instead of each test, to allow onFocusUpdate tests to retain shared state between each it() block
Opening this in draft mode to kick off CI and see if the |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5698/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5698/ |
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! 🦑
src/components/datagrid/body/header/data_grid_header_cell_wrapper.test.tsx
Outdated
Show resolved
Hide resolved
Preview documentation changes for this PR: https://eui.elastic.co/pr_5698/ |
Summary
We had a
utils/focus.test.ts
file, but it only had tests forgetParentCellContent
. This PR writes unit tests for all the remaining exported utilities in the file.Before
After
Note that the missing lines/functions are the empty arrow function initialized as placeholders in DataGridFocusContext:
I couldn't be bothered to write a suite of tests just to initialize focus context and call noop fns 🤷♀️
unmount_enzyme.js side effect
8b0baa3#diff-fe768e7e63543f0b9a2ef9d1c41b9248f87d76d04d0d9fa0a6dcd341697d6883 / 7bd108e
We had this conversation mostly in Slack, so I'm mentioning it here in the main GitHub issue for completeness. I wanted to avoid automatically unmounting components (i.e. preserving state) between each
it()
test, to build upon state between tests. TheafterEach
->afterAll
change allows me to do so with minimal impact on memory leakage.Checklist
No changelog; should be dev-only changes