From 219c8f76198a53eeb7959209c32e2b8db83b83b5 Mon Sep 17 00:00:00 2001 From: Andrew Hanna Date: Tue, 8 Jul 2014 14:49:10 -0600 Subject: [PATCH] Initial commit. --- .gitignore | 5 ++++ .travis.yml | 1 + LICENSE | 22 ++++++++++++++++ README.md | 22 ++++++++++++++++ bower.json | 31 +++++++++++++++++++++++ chai-react.js | 56 +++++++++++++++++++++++++++++++++++++++++ package.json | 32 +++++++++++++++++++++++ test/chai-react-spec.js | 4 +++ test/index.html | 23 +++++++++++++++++ 9 files changed, 196 insertions(+) create mode 100644 .gitignore create mode 100644 .travis.yml create mode 100644 LICENSE create mode 100644 README.md create mode 100644 bower.json create mode 100644 chai-react.js create mode 100644 package.json create mode 100644 test/chai-react-spec.js create mode 100644 test/index.html diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b143ad0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.settings.xml +node_modules/ +bower_components/ +.DS_Store +*.swp diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..587bd3e --- /dev/null +++ b/.travis.yml @@ -0,0 +1 @@ +language: node_js diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..677b380 --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2014 Andrew Hanna + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..ba9b339 --- /dev/null +++ b/README.md @@ -0,0 +1,22 @@ +# chai-react + +chai-react is an extension to the [chai](http://chaijs.com/) assertion library that +provides a set of React-specific assertions. + +## Contributing + +To run the test suite, run `npm install` (requires +[Node.js](http://nodejs.org/) to be installed on your system), and open +`test/index.html` in your web browser. + +## License + +Copyright (c) 2014 Andrew Hanna + +MIT License (see the LICENSE file) + +## Credits + +Thanks to [John Firebaugh](https://github.com/jfirebaugh) for providing +[chai-jquery](https://github.com/chaijs/chai-jquery/), which served as a +foundation for this plugin. diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..5b40388 --- /dev/null +++ b/bower.json @@ -0,0 +1,31 @@ +{ + "name": "chai-react", + "main": "chai-react.js", + "version": "0.0.1", + "authors": [ + "Andrew Hanna " + ], + "description": "React assertions for Chai.", + "moduleType": [ + "amd", + "node" + ], + "keywords": [ + "chai", + "react", + "testing", + "assertion" + ], + "license": "MIT", + "private": true, + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ], + "dependencies": { + "react": "~0.10.0" + } +} diff --git a/chai-react.js b/chai-react.js new file mode 100644 index 0000000..763b864 --- /dev/null +++ b/chai-react.js @@ -0,0 +1,56 @@ +(function (chaiReact) { + // Module systems magic dance. + if (typeof require === "function" && typeof exports === "object" && typeof module === "object") { + // NodeJS + module.exports = chaiReact; + } else if (typeof define === "function" && define.amd) { + // AMD + define(['react'], function (React) { + return function (chai, utils) { + return chaiReact(chai, utils, React); + }; + }); + } else { + // Other environment (usually + + + + + + + + +
+ +