Comments (5)
it seems like the outputs are actually different? the actual component output seems to be wrapped in an additional div?
from enzyme-matchers.
Hmm, maybe. Perhaps I haven't grokked everything about hos JSX works and how it interacts with these wrappers and test matchers.
Anyhow, I updated the test to not wrap the component in a <div>
and instead just render it directly: Saser/tocontainreact-failing @ 1a8ed51
. The test is still failing, with this output:
Expected <Item> to contain <span>outer<span>inner</span></span> but it was not found.
HTML Output of <Item>:
<span>outer<span>inner</span></span>
from enzyme-matchers.
Oh, another note: if I "cheat" and just return the expected output directly, the test is passing.
const Item = () => <span>outer<span>inner</span></span>;
EDIT: if I use the above cheat and also change the test to the following (note the not
):
expect(shallowWrapper).not.toContainReact(expected);
the test fails (obviously), but with the below output:
Expected <Item> not to contain <span>outer<span>inner</span></span> but it does.
HTML Output of <Item>:
<span>outer<span>inner</span></span>
Note that the HTML output appears to be the same as for the original recursive implementation and test.
from enzyme-matchers.
Apologies, I haven't had time to dig into this. If you want to look into the code and figure out what's happening I would happily accept a PR!
from enzyme-matchers.
Dug into this. Pretty sure there isn't an issue here. I tried to look at your repo, but looks like you deleted it. I'm going to close this for now. If you can help me dive into it sometime I'd love to figure out what's going on.
from enzyme-matchers.
Related Issues (20)
- Flow cannot resolve globalized enzyme variables HOT 4
- jest-enzyme + typescript: non-string selectors are rejected HOT 2
- jest-enzyme not working with create-react-app HOT 3
- jest-environment-enzyme has vulnerability in dependencies HOT 1
- README must explain why not jest-environment-jsdom HOT 2
- 7.0.1 -> 7.0.2 Incompatible with node 9 HOT 1
- Incorrect flow typing for getDisplayName HOT 1
- Matchers incompatible with @types/jest 24.0.20 HOT 4
- Rename toContainReact HOT 3
- v7.1.2 is not working on IE HOT 2
- toBeDisabled not working as expected HOT 4
- Update jest-environment-jsdom in jest-environment-enzyme
- argv.config.match is not a function, Process finished with exit code 1
- Transfer to the enzymejs org? HOT 11
- Release new version of `jest-environment-enzyme` HOT 8
- jest-enzyme: docs: installing jest-enzyme and its type defs HOT 1
- The current version of jest-enzyme breaks the latest version of jest HOT 6
- Status of the project HOT 13
- jest-enzyme: vulnerability related to unset-value HOT 1
- `toContainMatchingElement` considers `className` prop rather than actual HTML HOT 6
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-matchers.