Upgrades React

This commit is contained in:
Alex Corey
2021-12-06 10:55:00 -05:00
parent 5512b71e16
commit f37b070965
6 changed files with 482 additions and 232 deletions

698
awx/ui/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -23,9 +23,9 @@
"js-yaml": "^3.13.1", "js-yaml": "^3.13.1",
"luxon": "^2.0.1", "luxon": "^2.0.1",
"prop-types": "^15.6.2", "prop-types": "^15.6.2",
"react": "^16.13.1", "react": "17.0.2",
"react-ace": "^9.3.0", "react-ace": "^9.3.0",
"react-dom": "^16.13.1", "react-dom": "17.0.2",
"react-error-boundary": "^3.1.3", "react-error-boundary": "^3.1.3",
"react-router-dom": "^5.1.2", "react-router-dom": "^5.1.2",
"react-virtualized": "^9.21.1", "react-virtualized": "^9.21.1",
@@ -40,6 +40,7 @@
"@lingui/loader": "^3.8.3", "@lingui/loader": "^3.8.3",
"@lingui/macro": "^3.7.1", "@lingui/macro": "^3.7.1",
"@nteract/mockument": "^1.0.4", "@nteract/mockument": "^1.0.4",
"@wojtekmaj/enzyme-adapter-react-17": "0.6.5",
"babel-core": "^7.0.0-bridge.0", "babel-core": "^7.0.0-bridge.0",
"enzyme": "^3.10.0", "enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.14.0", "enzyme-adapter-react-16": "^1.14.0",

View File

@@ -2,6 +2,7 @@ import React from 'react';
import { act } from 'react-dom/test-utils'; import { act } from 'react-dom/test-utils';
import { RootAPI } from 'api'; import { RootAPI } from 'api';
import * as SessionContext from 'contexts/Session'; import * as SessionContext from 'contexts/Session';
import { shallow } from 'enzyme';
import { mountWithContexts } from '../testUtils/enzymeHelpers'; import { mountWithContexts } from '../testUtils/enzymeHelpers';
import App, { ProtectedRoute } from './App'; import App, { ProtectedRoute } from './App';
@@ -29,7 +30,7 @@ describe('<App />', () => {
let wrapper; let wrapper;
await act(async () => { await act(async () => {
wrapper = mountWithContexts(<App />); wrapper = shallow(<App />);
}); });
expect(wrapper.length).toBe(1); expect(wrapper.length).toBe(1);
jest.clearAllMocks(); jest.clearAllMocks();

View File

@@ -1,4 +1,4 @@
import React, { Fragment } from 'react'; import React from 'react';
import { BackgroundImage } from '@patternfly/react-core'; import { BackgroundImage } from '@patternfly/react-core';

View File

@@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import { configure } from 'enzyme'; import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16'; import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
require('@babel/polyfill'); require('@babel/polyfill');

View File

@@ -103,7 +103,7 @@ function applyDefaultContexts(context) {
return defaultContexts; return defaultContexts;
} }
const newContext = {}; const newContext = {};
Object.keys(defaultContexts).forEach(key => { Object.keys(defaultContexts).forEach((key) => {
newContext[key] = { newContext[key] = {
...defaultContexts[key], ...defaultContexts[key],
...context[key], ...context[key],
@@ -148,7 +148,7 @@ export function mountWithContexts(node, options = {}) {
export function waitForElement( export function waitForElement(
wrapper, wrapper,
selector, selector,
callback = el => el.length === 1 callback = (el) => el.length === 1
) { ) {
const interval = 100; const interval = 100;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {