Calling the html() method on a mounted Fragment whose children are components returns "null".
The mounted component should produce a string representation of its html content.
See this example on codesandbox.
I believe that this issue is related to another issue which I raised yesterday; by manually applying the fix that has now been made to ReactWrapper.js within the core enzyme package to a local repository in which this is an issue, a correct output is produced. Is there a reason why, despite having a fix for this merged into master, a newer version of the enzyme core has not been released? The various adaptor releases have all been updated.
| library | version
| ------------------- | -------
| enzyme | 3.8.0
| react | 16.7.0
| react-dom | 16.7.0
| react-test-renderer | N/A
| adapter (below) | 1.9.1
If that fix fixes your issue, then this can be closed as a duplicate of #2002.
The reason it's not released yet is because I simply haven't done it yet - every commit doesn't trigger a release (that's irresponsible and creates lots of churn for users), so the fix will be in the next version.
In the related issue it seems that you have changed files in both the adapters and the core enzyme product but only released the stuff for the adapters. I agree with OP that the core enzyme bundle should be bumped as well as there is no easy way to get the changes into a CI build. From the code sandbox above, it can be seen that the pairing of the new version of the adapter and the 'old' enzyme doesn't work and so enzyme should be patched as well with the changes made in ReactWrapper.js
If that fix fixes your issue, then this can be closed as a duplicate of #2002.
As the issue reported in #2002 is fixed in _released_ code, and this reported issue is only fixed in _unreleased_ code, I would beg to differ. They are two distinct issues, fixed by different changes, and should be treated as such. Is it ordinary practice for issues with enzyme to be closed before their fixes have been published?
The reason it's not released yet is because I simply haven't done it yet - every commit doesn't trigger a release (that's irresponsible and creates lots of churn for users), so the fix will be in the next version.
I appreciate that commits do not automatically trigger a release, and agree that that is good practice. I'm simply confused as to why the adapter versions have been bumped while the core versions have not.
I had assumed it was because the adapter changes were sufficient to solve #2002 (and therefore it could be closed), but given that this issue has been closed without resolution I don't know any more.
Issues are typically closed when they鈥檙e fixed in master; releases are independent.
The adapters are easy to bump, and doing so does not result in a flood of incoming bug reports. However, the next release of the enzyme package has a large number of changes in it, and quickly releasing it might result in exactly that. I鈥檓 waiting to release it until i have time to field those incoming issues.
Absolutely a release of enzyme itself is needed for users to get the fix - that鈥檚 just something you鈥檒l have to wait for.
@ljharb it still doesn't work with latest adapter version, now returning empty string instead of null.
https://codesandbox.io/s/032mpxq6rv
v3.10.0 has now been released.
Please file a new issue you're still having problems.