Skip to content

Commit 0991197

Browse files
committed
Keep Jest env to node but add createElement for portal test
1 parent 07fbab1 commit 0991197

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/__tests__/visitor.test.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { JSDOM } from 'jsdom'
2+
13
import React, {
24
Component,
35
Fragment,
@@ -27,9 +29,8 @@ import {
2729

2830
import { visitElement } from '../visitor'
2931

30-
const {
31-
ReactCurrentDispatcher
32-
} = (React: any).__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
32+
const { ReactCurrentDispatcher } = (React: any)
33+
.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
3334

3435
let prevDispatcher = null
3536

@@ -173,6 +174,7 @@ describe('visitElement', () => {
173174
})
174175

175176
it('returns nothing for portal components', () => {
177+
const document = new JSDOM().window.document
176178
const portal = createPortal(<Noop />, document.createElement('div'))
177179
const children = visitElement(portal, [], () => {})
178180
expect(children.length).toBe(0)

0 commit comments

Comments
 (0)