Comments (13)
It works ❤️
from enzyme-to-json.
@FezVrasta v3.1.3 is out!
from enzyme-to-json.
Thank you!
from enzyme-to-json.
Hi @ShaneDrury!
As you say I'm checking for null
and undefined
values, but not all falsy values. Although it seems weird that it give
exports[`falsey case 1`] = `undefined`;
it should give
exports[`falsey case 1`] = `false`;
I will have a look but I think I will stick to an empty string for null
and undefined
only as you might want to see if you component returns false
sometimes.
from enzyme-to-json.
I'm still reproducing something similar (or the same?) with 3.1.2
<div styleName="CarouselDot__inner">
{!!icon && <Icon styleName="CarouselDot__icon" name={icon} />}
</div>
When icon
is evaluated as false
the snapshot will read:
<div
className="CarouselDot__inner"
>
<undefined />
</div>
If I change it to {icon ? <Icon styleName="CarouselDot__icon" name={icon} /> : null}
it works properly.
The weird thing is that my whole project makes use of renders of this kind, and only this component gives me this problem.
Ideas?
from enzyme-to-json.
Hey @FezVrasta, that's my bad, I haven't released a new version including the fix. I'll get v3.1.3 out asap.
from enzyme-to-json.
Nope, no way... I'm getting the same problem of before even with 3.1.3... I double checked it 😓
Note that my component doesn't return just false
, it returns something like: <div>{false}</div>
from enzyme-to-json.
@FezVrasta I will have a look now.
from enzyme-to-json.
I'm going to send a PR to add a failing test, if I manage to get one.
from enzyme-to-json.
Don't worry I just reproduced the issue so I have a failing test.
Thanks for reporting the issue by the way.
from enzyme-to-json.
Oh, I just finished the PR lol.
nevermind then 😇
from enzyme-to-json.
Haha sorry, good news is that I fixed it already.
from enzyme-to-json.
@FezVrasta it should be fixed in v3.1.4
🎉
from enzyme-to-json.
Related Issues (20)
- render() returns null for <script> tag HOT 2
- Deep mode includes ForwardRef HOT 6
- Component created using React.memo appears as "Component" in snapshot HOT 5
- Missing displayName for styled-component 4.x HOT 1
- Add @types/enzyme as a dependency HOT 1
- Memo Component as a prop renders as <UNDEFINED /> in snapshot HOT 1
- 3.3.5: TypeError: Cannot convert a Symbol value to a string HOT 1
- mount Fragment with new style (<>...</>) return null HOT 2
- Looking for maintainers HOT 2
- 3.4.1 error -- TypeError: Cannot read property '$$typeof' of undefined HOT 4
- moving from 3.4.0 to 3.4.1 breaks snapshots HOT 3
- Cannot find type definition file for 'cheerio'. HOT 1
- Timestamp key in mock function lead to fail snapshot test HOT 1
- Node crashes when using toJson HOT 7
- ForwardRef included in deep mount
- Allow depth option when serializing mounted wrappers
- JSON changes with each run - React 17 and ReactDOM.createPortal()
- High severity vulnerability found in lodash 4.17.15 HOT 6
- cannot find module 'cheerio' from 'node_modules/enzyme/build/utils.js
- Critical Security Issues Report
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from enzyme-to-json.