├── .babelrc ├── .gitignore ├── assets ├── homer.jpg └── main.css ├── package.json ├── readme.md ├── src └── components │ ├── FollowButton.jsx │ ├── ProfilePicture.jsx │ └── UserProfile.jsx ├── test └── avatarSpec.jsx └── wallaby.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015", "react"] 3 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | /.idea -------------------------------------------------------------------------------- /assets/homer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wallabyjs/wallaby-react-component/98d5e965c669e0ae2aff926958cdff51713156a3/assets/homer.jpg -------------------------------------------------------------------------------- /assets/main.css: -------------------------------------------------------------------------------- 1 | * { 2 | margin: 0; 3 | padding: 0; 4 | font: 24px "Helvetica Neue", Helvetica, Arial, sans-serif; 5 | } 6 | 7 | body { 8 | margin-left: 20px; 9 | margin-top: 20px; 10 | } 11 | 12 | p { 13 | width: 200px; 14 | height: 40px; 15 | color: white; 16 | border-radius: 5px; 17 | text-align: center; 18 | line-height: 38px; 19 | } 20 | 21 | p.follow { 22 | background-color: #0084B4; 23 | } 24 | 25 | p.unfollow { 26 | background-color: salmon; 27 | } 28 | 29 | img { 30 | width: 200px; 31 | margin-bottom: 10px; 32 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "dependencies": { 4 | "react": "^0.14.7" 5 | }, 6 | "devDependencies": { 7 | "babel-core": "^6.4.5", 8 | "babel-preset-es2015": "^6.3.13", 9 | "babel-preset-react": "^6.3.13", 10 | "phantomjs-polyfill": "0.0.1" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | [](https://wallabyjs.com) 2 | 3 | # React components testing with wallaby.js 4 | [See the tutorial for more details.](http://dm.gl/2015/03/11/wallaby-react/) 5 | 6 |  7 | -------------------------------------------------------------------------------- /src/components/FollowButton.jsx: -------------------------------------------------------------------------------- 1 | var FollowButton = React.createClass({ 2 | 3 | handleClick() { 4 | this.setState({text: 'Unfollow'}); 5 | }, 6 | 7 | render() { 8 | return ( 9 |
10 | {this.state && this.state.text || 'Follow ' + this.props.username} 11 |
12 | ); 13 | } 14 | }); -------------------------------------------------------------------------------- /src/components/ProfilePicture.jsx: -------------------------------------------------------------------------------- 1 | var ProfilePicture = React.createClass({ 2 | render: function () { 3 | return ( 4 |