Created
March 12, 2013 14:41
-
-
Save ruudud/5143435 to your computer and use it in GitHub Desktop.
Buster/Sinon test click handler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var assert = buster.assertions.assert; | |
var refute = buster.assertions.refute; | |
var testCase = buster.testCase('my views', { | |
'spy reg': function () { | |
var View = Backbone.View.extend({ | |
events: { 'click': 'myclick' }, | |
myclick: function () { | |
console.log('orig handler click'); | |
} | |
}); | |
var myView = new View(); | |
myView.myclick = sinon.spy(); | |
myView.delegateEvents(); | |
myView.$el.trigger('click'); | |
assert.calledOnce(myView.myclick); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment