-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Columns not rendering consistently during tests #4165
Comments
Hi @chrisahardie, this is by no means the ideal solution but have you tried adding the |
Thanks @matthewwoodruff , sorry I didn't find this during my search of issues! Setting the attribute does appear to work, so I'll use it as a workaround. I presume you are tracking this elsewhere and it's ok to close this issue? |
Hi, Your ticket has been flagged as in_zendesk, it means that we recognize this as an issue worth investigating so we have moved it to our official support channel for customers (zendesk) We will carry on there with the investigation and we will update you as soon as possible. Thanks |
Hi, Thanks for raising this issue. Ag-grid renders the columns based on the viewport, if the viewport is not rendered properly or there are no dimensions the grid will not render any columns. As matthewwoodruff already noted, you can suppress this behaviour with suppressColumnVirtualisation. This will force the grid to render all the columns in the grids viewport. Hope this helps! |
@davis4acca In a unit test environment is there a way you would recommend setting the viewport dimensions so the grid can obtain the dimensions correctly? For example when using react testing library |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This appears to be a recommended solution on the ag-grid blog.
https://blog.ag-grid.com/testing-ag-grid-react-jest-enzyme/#querying-dom |
hell yeah! solved this long lasting headache thanks to @matthewwoodruff |
@fcaballero I have the same problem. Did you solve it? |
@itsgdpierzchalski we've upgraded to version 28, that should solve the issue. |
For anyone who finds this ticket and is running tests with jsdom then as of AG Grid 31.0.3 you no longer need to suppress column virtualization. |
we are on 31.2.0 and this bug was driving me nuts with vitest and react-testing-library. suppressColumnVirtualisation helped, but it's not ideal |
I am facing a similar issue with filters. I have a location Filter and it has checkboxes for different locations. The first checkbox is always Select All. For some reason, in my test cases, only the Select All checkbox is rendered in the DOM, and the other checkboxes for other locations are not rendered. I have used suppressFilterVirtualisation and many other solutions but nothing has worked. |
I'm submitting a ... (check one with "x")
Providing a Reproducible Scenario
The reproducible scenario depends on a test environment, so I have created a Github project that demonstrates the issue:
https://github.com/chrisahardie/ag-grid-rtl
Current behavior
Under certain circumstances, ag-grid will not render all expected columns during testing. In the aforementioned project I created, there are two tests exercising two ag-grid grids. The grid that fails testing differs from the grid that passes testing by a couple column definitions:
My test attempts to find part of the consignee's name in the mounted grid:
When I run
npm run test
this test will fail, and the markup the component has emitted during failure will be written to the terminal. Theccn
column appears, but theconsignee
column does not.If I remove the first column definition - the checkbox - then the consignee column WILL get rendered and this test will start passing!
Expected behavior
All columns should be rendered consistently as they are rendered in the browser.
Please tell us about your environment:
Windows, VS Code, npm, Jest,
ag-Grid version: X.X.X
18.1.2
Browser:
N/A Node v. 12.16.1
Language:
all
The text was updated successfully, but these errors were encountered: