Package Exports
- spyquery
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (spyquery) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
SpyQuery
Emulates jQuery as sinon spies, so you can test code that uses jQuery on the server or in the browser.
Installation
Nodejs:
npm install spyqueryBrowser Global $:
<script src="spyquery.js"></script>Usage
Initialization
var SpyQuery = require('spyquery')
var $ = new SpyQuery()Checking Spies
> $('.foo').html()
> {}
> $.fn.html.callCount
> 1You are able to check any of the attributes of a sinon spy.
Example Usage In Tests
var $
describe(function() {
beforeEach(function(done) {
$ = new SpyQuery()
done()
}
it('should call hide once', function(done) {
someFunctionWhereHideIsUsed()
assert($.fn.hide.calledOnce, '$.hide() was called more than once')
done()
}
})