Created
May 19, 2015 16:15
-
-
Save jhollingworth/8d058ae8e65351854a85 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let testTree = require('react-test-tree'); | |
class Foo extends React.Component { | |
render() { | |
return ( | |
<div className="Foo"> | |
<Bar ref="bar1" /> | |
<Bar ref="bar2" /> | |
</div> | |
); | |
} | |
} | |
class Bar extends React.Component { | |
render() { | |
return ( | |
<div className="Bar"> | |
<Baz ref="baz" /> | |
</div> | |
); | |
} | |
} | |
class Baz extends React.Component { | |
render() { | |
return <div className="Baz" />; | |
} | |
} | |
let foo = testTree(<Foo />, { | |
stub: { | |
bar1: null, // Don't render this component, | |
bar2: { | |
baz: <div />, // render div instead | |
} | |
} | |
}); | |
expect(foo.bar1).to.not.exist; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment