Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jadu/sinon-jquery
Sinon matcher for matching jQuery collections
https://github.com/jadu/sinon-jquery
Last synced: 30 days ago
JSON representation
Sinon matcher for matching jQuery collections
- Host: GitHub
- URL: https://github.com/jadu/sinon-jquery
- Owner: jadu
- License: mit
- Created: 2015-09-11T10:19:25.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T03:11:41.000Z (almost 2 years ago)
- Last Synced: 2024-10-12T14:39:50.690Z (about 1 month ago)
- Language: JavaScript
- Size: 596 KB
- Stars: 1
- Watchers: 31
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
Sinon-jQuery
============[![Build Status](https://secure.travis-ci.org/jadu/sinon-jquery.png?branch=master)](http://travis-ci.org/jadu/sinon-jquery)
Sinon matcher for matching jQuery collections.
```javascript
npm install --save-dev sinon-jquery
```Add to your test harness:
```javascript
var $ = require('jquery'),
sinon = require('sinon'),
sinonjQuery = require('sinon-jquery');
sinonjQuery.useWith(sinon, $);
```We recommend you use this with [Sinon-Chai][] (`npm install --save-dev sinon-chai`)
```javascript
var chai = require('chai'),
sinonChai = require('sinon-chai');chai.use(sinonChai);
```Then use as a matcher, eg. with Mocha+Chai+Sinon-Chai+Sinon-jQuery:
```javascript
it('should pass a element to Display.show()', function () {
this.handler.handle();expect(this.display.show).to.have.been.calledWith(sinon.match.jQuery('section'));
});
```[Sinon-Chai]: https://github.com/domenic/sinon-chai