GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Use createRoot in ReactART-test by jackpope · Pull Request #28060 · react/react

Use createRoot in ReactART-test #28060

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
jackpope merged 4 commits into react:main from jackpope:react-art-test-2
Jan 23, 2024

Uh oh!

There was an error while loading. Please reload this page.

Merged

Use createRoot in ReactART-test #28060

Changes from 1 commit
Commits
Show all changes
4 commits
Select commit Hold shift + click to select a range
ec4149a
Remove ReactTestUtils from ReactArt-test
Jan 23, 2024
ad13f39
Fix lint errors
Jan 23, 2024
f4111e2
Use createRoot in ReactART-test
Jan 23, 2024
dd8f77a
Merge branch 'main' into react-art-test-2
jackpope Jan 23, 2024
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Next Next commit
Remove ReactTestUtils from ReactArt-test
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

Jack Pope
Jack Pope committed Jan 23, 2024
commit ec4149ac576cd390dcd77d02d5af28fbf9608acc

There are no files selected for viewing

52 changes: 33 additions & 19 deletions 52 packages/react-art/src/__tests__/ReactART-test.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ import Wedge from 'react-art/Wedge';
// Isolate DOM renderer.
jest.resetModules();
const ReactDOM = require('react-dom');
const ReactTestUtils = require('react-dom/test-utils');
const ReactDOMClient = require('react-dom/client');
const act = require('internal-test-utils').act;

// Isolate test renderer.
jest.resetModules();
Expand All @@ -42,6 +43,7 @@ let Surface;
let TestComponent;

let waitFor;
let groupRef;

const Missing = {};

Expand Down Expand Up @@ -82,8 +84,9 @@ describe('ReactART', () => {

({waitFor} = require('internal-test-utils'));

groupRef = React.createRef();
TestComponent = class extends React.Component {
group = React.createRef();
group = groupRef;

render() {
const a = (
Expand Down Expand Up @@ -132,17 +135,23 @@ describe('ReactART', () => {
container = null;
});

it('should have the correct lifecycle state', () => {
it('should have the correct lifecycle state', async () => {
let instance = <TestComponent />;
instance = ReactTestUtils.renderIntoDocument(instance);
const group = instance.group.current;
const root = ReactDOMClient.createRoot(container);
await act(() => {
root.render(instance);
});
const group = groupRef.current;
// Duck type test for an ART group
expect(typeof group.indicate).toBe('function');
});

it('should render a reasonable SVG structure in SVG mode', () => {
it('should render a reasonable SVG structure in SVG mode', async () => {
let instance = <TestComponent />;
instance = ReactTestUtils.renderIntoDocument(instance);
const root = ReactDOMClient.createRoot(container);
await act(() => {
root.render(instance);
});

const expectedStructure = {
nodeName: 'svg',
Expand All @@ -165,7 +174,7 @@ describe('ReactART', () => {
],
};

const realNode = ReactDOM.findDOMNode(instance);
const realNode = container.firstChild;
testDOMNodeStructure(realNode, expectedStructure);
});

Expand Down Expand Up @@ -243,7 +252,7 @@ describe('ReactART', () => {
ReactDOM.unmountComponentAtNode(container);
});

it('renders composite with lifecycle inside group', () => {
it('renders composite with lifecycle inside group', async () => {
let mounted = false;

class CustomShape extends React.Component {
Expand All @@ -255,18 +264,20 @@ describe('ReactART', () => {
mounted = true;
}
}

ReactTestUtils.renderIntoDocument(
<Surface>
<Group>
<CustomShape />
</Group>
</Surface>,
);
const root = ReactDOMClient.createRoot(container);
await act(() => {
root.render(
<Surface>
<Group>
<CustomShape />
</Group>
</Surface>,
);
});
expect(mounted).toBe(true);
});

it('resolves refs before componentDidMount', () => {
it('resolves refs before componentDidMount', async () => {
class CustomShape extends React.Component {
render() {
return <Shape />;
Expand All @@ -293,7 +304,10 @@ describe('ReactART', () => {
}
}

ReactTestUtils.renderIntoDocument(<Outer />);
const root = ReactDOMClient.createRoot(container);
await act(() => {
root.render(<Outer />);
});
expect(ref.constructor).toBe(CustomShape);
});

Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402809 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.