Created
May 19, 2015 16:14
-
-
Save jhollingworth/b10eda7788ef60b05037 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 Bar extends React.Component { | |
render() { | |
return ( | |
<div className="Bar"> | |
<span className="Bar-name" ref="name"> | |
{this.props.name} | |
</span> | |
</div> | |
); | |
} | |
} | |
class Foo extends React.Component { | |
render() { | |
return ( | |
<div className="Foo" refCollection="bars"> | |
{this.props.bars.map(bar => <Bar name={bar.name} />)} | |
</div> | |
); | |
} | |
} | |
let bars = [{ name: "foo" }, { name: "bar" }, { name: "baz"}]; | |
let foo = testTree(<Foo bars={bars} />); | |
expect(foo.bars[1].name.innerText).to.eql("bar"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment