Skip to content

Commit

Permalink
bump min-react-env
Browse files Browse the repository at this point in the history
  • Loading branch information
goto-bus-stop committed Dec 26, 2024
1 parent 81fb92a commit 88c2e34
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"eslint-plugin-react": "^7.20.3",
"eslint-plugin-react-hooks": "^4.0.5",
"md-insert": "^1.0.1",
"min-react-env": "^1.0.1",
"min-react-env": "^2.0.0",
"prop-types-table": "^1.0.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
Expand Down
10 changes: 6 additions & 4 deletions test/util/render.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
* https://github.com/troybetz/react-youtube
*/

/* global document */

import React from 'react';
import ReactDOM from 'react-dom';
import { act } from 'react-dom/test-utils';
import env from 'min-react-env';
import 'min-react-env/install';
import createYouTube from './createYouTube';

Object.assign(global, env);
const reactMajor = parseInt((ReactDOM.version || '16').split('.')[0], 10);

async function render(initialProps) {
const { YouTube, sdkMock, playerMock } = createYouTube();
Expand Down Expand Up @@ -44,9 +46,9 @@ async function render(initialProps) {
}
}

const div = env.document.createElement('div');
const div = document.createElement('div');
let root;
if (ReactDOM.version.startsWith('18') || ReactDOM.version.startsWith('19')) {
if (reactMajor >= 18) {
const { createRoot } = await import('react-dom/client');
root = createRoot(div);
} else {
Expand Down

0 comments on commit 88c2e34

Please sign in to comment.