sinon-jquery
v1.0.3
Published
Sinon matcher for matching jQuery collections
Downloads
2,209
Readme
Sinon-jQuery
Sinon matcher for matching jQuery collections.
npm install --save-dev sinon-jquery
Add to your test harness:
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
)
var chai = require('chai'),
sinonChai = require('sinon-chai');
chai.use(sinonChai);
Then use as a matcher, eg. with Mocha+Chai+Sinon-Chai+Sinon-jQuery:
it('should pass a <section> element to Display.show()', function () {
this.handler.handle();
expect(this.display.show).to.have.been.calledWith(sinon.match.jQuery('section'));
});