We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Reproduce steps:
I have a component as follow:
export default function TextView(props) { return ( <Overlay> <div className={styles.container}> <div className={styles.header} data-l10n-id="scann-dialog-title-text" /> <div ref={elem => props.onRef(elem)} className={styles.body}> {props.text} </div> </div> </Overlay> ); }
when I tested this component with jest. I mocked Overlay component.
Overlay
jest.mock("./components", () => { return { Overlay: ({ className, style, children }) => { return (<div id={"mockedOverlayComponent"}>{children}</div>); } }; });
then using renderIntoContainer to render TextView.
renderIntoContainer
TextView
const renderedTree = renderIntoContainer(<TextView {...props} />);
I expect renderedTree.dom is instance of HTMLElement. Actually, renderedTree.dom is null.
renderedTree.dom
HTMLElement
PS: But when I use render from inferno to render TextView. const render = require('inferno').render; const renderedTree = render(<TextView {...props} />, dom); the renderedTree.dom is domElement, children is correctly render, the final result is: <div id="mockedOverlayComponent"> <div class="container"> <div class="header" data-l10n-id="scann-dialog-title-text" /> <div class="body"> testText </div> </div> </div>
PS: But when I use render from inferno to render TextView.
render
inferno
const render = require('inferno').render; const renderedTree = render(<TextView {...props} />, dom);
the renderedTree.dom is domElement, children is correctly render, the final result is:
domElement
<div id="mockedOverlayComponent"> <div class="container"> <div class="header" data-l10n-id="scann-dialog-title-text" /> <div class="body"> testText </div> </div> </div>
So, I think maybe renderIntoContainer method has some problems. Please help to deal with this issue.
Looking forward to your reply. Thanks.
The text was updated successfully, but these errors were encountered:
Hi,
thanks for reporting this issue, this indeed sounds like a bug.
One possible issue is that renderIntoContainer does not seem to attach the html element to DOM. This may cause issues in some cases.
Sorry, something went wrong.
No branches or pull requests
Reproduce steps:
I have a component as follow:
when I tested this component with jest. I mocked
Overlay
component.then using
renderIntoContainer
to renderTextView
.const renderedTree = renderIntoContainer(<TextView {...props} />);
I expect
renderedTree.dom
is instance ofHTMLElement
. Actually,renderedTree.dom
is null.So, I think maybe renderIntoContainer method has some problems.
Please help to deal with this issue.
Looking forward to your reply.
Thanks.
The text was updated successfully, but these errors were encountered: