jest-html icon indicating copy to clipboard operation
jest-html copied to clipboard

React.Fragment not supported

Open Punith13 opened this issue 7 years ago • 9 comments

React.Fragment tag is not being supported and the element rendered loses the css content

Punith13 avatar Aug 05 '18 23:08 Punith13

Could you please provide an example of this?

guigrpa avatar Aug 12 '18 15:08 guigrpa

Could you please check whether the problem is solved in v1.5.0?

guigrpa avatar Aug 15 '18 15:08 guigrpa

No, the issue persists. I noticed that the NavLink element from react-router-dom is losing its CSS.

Eg:

 <div>
   <NavLink className='button is-info is-pulled-right is-rounded' to='/orders'>Orders </NavLink> 
 </div>

is correctly rendered as

<a class="button is-info is-pulled-right is-rounded" href="/orders">
       Orders
</a>

But inside React.Fragment,

 <React.Fragment>
   <NavLink className='button is-info is-pulled-right is-rounded' to='/orders'>Orders </NavLink> 
 </React.Fragment>

is incorrectly rendered as

<a aria-current="{null}" classname="button is-info is-pulled-right is-rounded" href="/orders" onclick="{[Function]}" style="{undefined}">
            Orders
 </a>

Punith13 avatar Aug 20 '18 04:08 Punith13

Did you manage to isolate the problem without react-router components? I mean, just with React.Fragment and simple divs, for instance...

guigrpa avatar Aug 20 '18 07:08 guigrpa

Yes, css on normal div is rendering correctly.

Punith13 avatar Aug 21 '18 02:08 Punith13

Any update on this issue?

Punith13 avatar Oct 23 '18 01:10 Punith13

Could you please provide an example of the error with React.Fragment but without React Router?

guigrpa avatar Oct 23 '18 04:10 guigrpa

Yes, facing the same issue without React Router as wel. Please find the sample @ https://github.com/Punith13/react-fragment-jest-html

Note the difference of css not being applied to "Test button" in the React.Fragment component

Punith13 avatar Oct 28 '18 23:10 Punith13

Any update on this issue?

Punith13 avatar Nov 27 '18 00:11 Punith13