Permalink
Browse files

send in value on delete event

  • Loading branch information...
1 parent 7d7898a commit ee7ba73ae969019dd11c68febcb33835a11bd2d8 Anders Carlsson and Jonas Nicklas committed Apr 2, 2012
Showing with 4 additions and 3 deletions.
  1. +1 −1 spec/collection.spec.coffee
  2. +3 −2 src/collection.coffee
@@ -93,7 +93,7 @@ describe 'Serenade.Collection', ->
expect(@collection).toHaveReceivedEvent('change')
it 'triggers a delete event', ->
@collection.deleteAt(1)
- expect(@collection).toHaveReceivedEvent('delete', with: [1])
+ expect(@collection).toHaveReceivedEvent('delete', with: [1, 'b'])
describe '#delete', ->
it 'removes the item from the collection', ->
View
@@ -38,9 +38,10 @@ class exports.Collection
find: (fun) ->
return item for item in @list when fun(item)
deleteAt: (index) ->
- @_notIn(@list[index])
+ value = @list[index]
+ @_notIn(value)
@list.splice(index, 1)
- @trigger("delete", index)
+ @trigger("delete", index, value)
@trigger("change", @list)
delete: (item) ->
@deleteAt(@indexOf(item))

0 comments on commit ee7ba73

Please sign in to comment.