Skip to content

Commit

Permalink
Added failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
rauchg authored and tj committed Jun 29, 2012
1 parent 13e19d5 commit 591f069
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion test/emitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,23 @@ describe('Emitter', function(){

calls.should.eql([]);
})

it('should work when called from an event', function(){
var emitter = new Emitter
, called
function b () {
called = true;
}
emitter.on('tobi', function () {
emitter.off('tobi', b);
});
emitter.on('tobi', b);
emitter.emit('tobi');
called.should.be.true;
called = false;
emitter.emit('tobi');
called.should.be.false;
});
})

describe('.off(event)', function(){
Expand Down Expand Up @@ -108,4 +125,4 @@ describe('Emitter', function(){
})
})
})
})
})

0 comments on commit 591f069

Please sign in to comment.