Last active
August 29, 2015 13:56
-
-
Save th3james/8827009 to your computer and use it in GitHub Desktop.
DOM event listener test
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
suite("PickUserView"); | |
test('when clicking the close button, the view gets closed', function() { | |
var view, viewCloseSpy; | |
// The function we expect to be called on close | |
viewCloseSpy = sinon.spy(ChooseUserView.prototype, 'close'); | |
view = new ChooseUserView(); | |
view.render(); | |
// Trigger the click event on the DOM element | |
view.$el.find('.close').trigger('click'); | |
// Stop spying | |
viewCloseSpy.restore(); | |
assert.ok( | |
viewCloseSpy.calledOnce, | |
"Expected viewCloseSpy to be called once but was called " + viewCloseSpy.callCount + " times" | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment