Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add forgotten test for multiple delegate events.

  • Loading branch information...
commit e27c208f43425e50a9d339306f9ba86b694add19 1 parent 0e17f32
@paulmillr paulmillr authored
Showing with 13 additions and 1 deletion.
  1. +13 −1 test/spec/view_spec.coffee
View
14 test/spec/view_spec.coffee
@@ -121,7 +121,7 @@ define [
view.render()
expect(spy).was.called()
- it 'should register user input events', ->
+ it 'should register and remove user input event handlers', ->
expect(view.delegate).to.be.a 'function'
expect(view.undelegate).to.be.a 'function'
@@ -148,6 +148,18 @@ define [
p.trigger 'click'
expect(spy.callCount).to.be 1
+ it 'should register and remove multiple user input event handlers', ->
+ spy = sinon.spy()
+ handler = view.delegate 'click keypress', spy
+ $(view.el).trigger 'click'
+ $(view.el).trigger 'keypress'
+ expect(spy).was.calledTwice()
+
+ view.undelegate()
+ $(view.el).trigger 'click'
+ $(view.el).trigger 'keypress'
+ expect(spy).was.calledTwice()
+
it 'should check delegate parameters', ->
expect(-> view.delegate()).to.throwError()
expect(-> view.delegate(1, 2, 3)).to.throwError()
Please sign in to comment.
Something went wrong with that request. Please try again.