-
Notifications
You must be signed in to change notification settings - Fork 87
React 19 #865
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.
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
React 19 #865
Changes from 4 commits
dfa8949
9c04215
cb37bfb
5ee48e9
f0ab798
ca59a86
28b29ac
9324db3
117f383
d6ec12f
4572974
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
/* eslint-disable react/no-string-refs */ | ||
|
||
import React, { Fragment, Component } from 'react'; | ||
import { createRenderer } from 'react-test-renderer/shallow'; | ||
import ShallowRenderer from 'react-shallow-renderer'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
update: it's because it depends on React internals and they've changed between majors. I wonder can the tests that depend on this be deleted. Not entirely sure what value they provide There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They cover some old pattern in class component. We could remove them and move on as shallow render is not a thing nowadays. |
||
import { render, screen } from '@testing-library/react'; | ||
import reactElementToJSXString, { preserveFunctionLineBreak } from './index'; | ||
import AnonymousStatelessComponent from './AnonymousStatelessComponent'; | ||
|
@@ -654,7 +654,7 @@ describe('reactElementToJSXString(ReactElement)', () => { | |
} | ||
|
||
const NestedSpan = myDecorator(<span />); | ||
const renderer = createRenderer(); | ||
const renderer = new ShallowRenderer(); | ||
renderer.render(<NestedSpan />); | ||
expect(reactElementToJSXString(renderer.getRenderOutput())).toEqual( | ||
`<div> | ||
|
@@ -671,7 +671,7 @@ describe('reactElementToJSXString(ReactElement)', () => { | |
} | ||
} | ||
|
||
const renderer = createRenderer(); | ||
const renderer = new ShallowRenderer(); | ||
renderer.render(<InlineProps name="John" />); | ||
const actualElement = renderer.getRenderOutput(); | ||
expect(reactElementToJSXString(actualElement)).toEqual( | ||
|
@@ -1300,6 +1300,21 @@ describe('reactElementToJSXString(ReactElement)', () => { | |
</Context.Provider>`); | ||
}); | ||
|
||
it('should stringify `Context` correctly', () => { | ||
const Ctx = React.createContext(); | ||
const App = () => {}; | ||
|
||
expect( | ||
reactElementToJSXString( | ||
<Ctx value={null}> | ||
<App /> | ||
</Ctx> | ||
) | ||
).toEqual(`<Context.Provider value={null}> | ||
<App /> | ||
</Context.Provider>`); | ||
}); | ||
|
||
it('should stringify `Contex.Provider` with `displayName` correctly', () => { | ||
const Ctx = React.createContext(); | ||
Ctx.displayName = 'MyCtx'; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's stop this madness and use this major version to only support react 19