Giter Club home page Giter Club logo

Comments (5)

blainekasten avatar blainekasten commented on May 18, 2024

it seems like the outputs are actually different? the actual component output seems to be wrapped in an additional div?

from enzyme-matchers.

saser avatar saser commented on May 18, 2024

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.

saser avatar saser commented on May 18, 2024

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.

blainekasten avatar blainekasten commented on May 18, 2024

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.

blainekasten avatar blainekasten commented on May 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.