1.0.3 • Published 4 years ago

sinon-jquery v1.0.3

Weekly downloads
503
License
MIT
Repository
github
Last release
4 years ago

Sinon-jQuery

Build Status

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'));
});