Testing with visx imports renders empty div
See original GitHub issueWhen testing using @testing-library/react
it renders a div like so:
<div style="width: 100%; height: 100%;" />
I thought it might be a resizing issue as the component is wrapped with a withParentSize
hoc and when I remove that it complains about needing a Resize-observer polyfill
Error: Uncaught [Error: This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills]
Haven’t found anything on the net about testing components with visx
Issue Analytics
- State:
- Created 3 years ago
- Comments:9
Top Results From Across the Web
testing-library/react rendering empty <div /> for a redux toolkit ...
But it's just rendering the empty in the body tag. import React from 'react'; import configureMockStore from 'redux-mock-store'; import * as ...
Read more >How to Write Your First Component Test in React + TypeScript ...
We need to test 3 things here: The name gets rendered in the p element with the correct text. The button doesn't get...
Read more >Introduction to Visx - LogRocket Blog
Find out why Visx is the most stable and reliable visualization library you can use and learn how to create a bar chart...
Read more >Testing library renders connected component as an empty ...
I imported my HOC, which connects my component to the redux store, but afterwards I saw in the console that it only rendered...
Read more >How to test SVG Graphs - Sam Dawson
This article is walk-through of testing a React Bar Graph with Jest and ... import { wait, render, screen } from "@testing-library/react"; ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@williaster switching to
ParentSize
solves the issue once you add aResizeObserver
pollyfill@williaster thanks for that thorough explanation. I will first try your solutions and report back with a link to my implementation if I run into issues.