这段代码能否以更具功能性/下划线风格进行重构,主要是检查 in 是否存在的addedEvents
部分actualEvents
?
describe 'when removing', ->
it 'should remove all bound events from the window', ->
@view.remove()
addedEvents = ['dragenter', 'drop', 'dragleave', 'register']
actualEvents = _.keys $._data(window, 'events') #=> ['onload', 'drop', 'etc.']
for event in addedEvents
present = _.contains(actualEvents, event)
expect(present).toBe(false)