sinon-jquery

1.0.3 • Public • Published

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

Package Sidebar

Install

npm i sinon-jquery

Weekly Downloads

535

Version

1.0.3

License

MIT

Unpacked Size

12.7 kB

Total Files

13

Last publish

Collaborators

  • asmblah