Skip to content

Instantly share code, notes, and snippets.

@jhollingworth
Created May 19, 2015 16:14
Show Gist options
  • Select an option

  • Save jhollingworth/89183e344f95ba9e33dc to your computer and use it in GitHub Desktop.

Select an option

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("foo@bar.com");
page.email.value = "bar@baz.com";
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