├── .travis.yml ├── .gitignore ├── README.md ├── bower.json ├── package.json ├── test ├── index.html └── chai-react-spec.js ├── LICENSE └── chai-react.js /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .settings.xml 2 | node_modules/ 3 | bower_components/ 4 | .DS_Store 5 | *.swp 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # chai-react 2 | 3 | chai-react is an extension to the [chai](http://chaijs.com/) assertion library that 4 | provides a set of React-specific assertions. 5 | 6 | ## Contributing 7 | 8 | To run the test suite, run `npm install` (requires 9 | [Node.js](http://nodejs.org/) to be installed on your system), and open 10 | `test/index.html` in your web browser. 11 | 12 | ## License 13 | 14 | Copyright (c) 2014 Andrew Hanna 15 | 16 | MIT License (see the LICENSE file) 17 | 18 | ## Credits 19 | 20 | Thanks to [John Firebaugh](https://github.com/jfirebaugh) for providing 21 | [chai-jquery](https://github.com/chaijs/chai-jquery/), which served as a 22 | foundation for this plugin. 23 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chai-react", 3 | "main": "chai-react.js", 4 | "version": "1.0.0", 5 | "authors": [ 6 | "Andrew Hanna " 7 | ], 8 | "description": "React assertions for Chai.", 9 | "moduleType": [ 10 | "amd", 11 | "globals", 12 | "node" 13 | ], 14 | "keywords": [ 15 | "chai", 16 | "react", 17 | "testing", 18 | "assertion" 19 | ], 20 | "license": "MIT", 21 | "ignore": [ 22 | "**/.*", 23 | "node_modules", 24 | "bower_components", 25 | "test", 26 | "tests" 27 | ], 28 | "dependencies": { 29 | "react": "~0.12.0" 30 | }, 31 | "homepage": "https://github.com/percyhanna/chai-react" 32 | } 33 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": "Andrew Hanna ", 3 | "name": "chai-react", 4 | "description": "React assertions for the Chai assertion library", 5 | "keywords": [ 6 | "test", 7 | "assertion", 8 | "assert", 9 | "testing", 10 | "react" 11 | ], 12 | "version": "1.0.0", 13 | "repository": { 14 | "type": "git", 15 | "url": "https://github.com/percyhanna/chai-react" 16 | }, 17 | "bugs": { 18 | "url": "https://github.com/percyhanna/chai-react/issues" 19 | }, 20 | "scripts": { 21 | "test": "mocha-phantomjs test/index.html" 22 | }, 23 | "main": "./chai-react", 24 | "engines": { 25 | "node": ">= 0.4.0" 26 | }, 27 | "devDependencies": { 28 | "chai": "1", 29 | "chai-array": "0.0.1", 30 | "envify": "^1.2.1", 31 | "es5-shim": "^4.0.0", 32 | "mocha": "1", 33 | "mocha-phantomjs": "3" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /test/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Mocha 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Andrew Hanna 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /chai-react.js: -------------------------------------------------------------------------------- 1 | (function (chaiReact) { 2 | // Module systems magic dance. 3 | if (typeof require === "function" && typeof exports === "object" && typeof module === "object") { 4 | // NodeJS 5 | module.exports = chaiReact; 6 | } else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(['react'], function (React) { 9 | return function (chai, utils) { 10 | return chaiReact(chai, utils, React); 11 | }; 12 | }); 13 | } else { 14 | // Other environment (usually