We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 1923336 + bca2cee commit f6c1356Copy full SHA for f6c1356
test/lazy.test.js
@@ -44,7 +44,7 @@ describe('lazy', () => {
44
});
45
46
it('should forward refs', async () => {
47
- const A = () => <h1>A</h1>;
+ const A = (props) => <h1 ref={props.ref}>A</h1>;
48
const LazyA = lazy(() => Promise.resolve(A));
49
50
const ref = {};
@@ -57,6 +57,13 @@ describe('lazy', () => {
57
);
58
await new Promise(r => setTimeout(r, 1))
59
60
- expect(ref.current.constructor).to.equal(A);
+ if (ref.current.constructor === A) {
61
+ // v10
62
+ expect(ref.current.constructor).to.equal(A);
63
+ } else {
64
+ // v11+
65
+ expect(ref.current).to.equal(scratch.firstChild);
66
+ }
67
68
69
+
0 commit comments