Skip to content

Instantly share code, notes, and snippets.

@jhollingworth
Created May 19, 2015 16:14
Show Gist options
  • Save jhollingworth/89183e344f95ba9e33dc to your computer and use it in GitHub Desktop.
Save jhollingworth/89183e344f95ba9e33dc to your computer and use it in GitHub Desktop.
let testTree = require('react-test-tree');
class LoginPage extends React.Component {
render() {
return (
<form className="LoginPage">
<input type="email" ref="email" value={this.state.email} />
<input type="password" ref="password" value={this.state.password} />
<input type="submit" ref="login" value="Login" />
</form>
);
}
}
let page = testTree(<LoginPage />);
expect(page.email.value).to.equal("[email protected]");
page.email.value = "[email protected]";
page.password.value = "password";
page.login.click();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment