From 59c6bb201c73b7966455d52b20b16c116c606cfc Mon Sep 17 00:00:00 2001 From: Per Liedman Date: Wed, 24 Aug 2016 09:52:29 +0200 Subject: [PATCH] Use spies as listeners --- spec/suites/core/EventsSpec.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/spec/suites/core/EventsSpec.js b/spec/suites/core/EventsSpec.js index 1336074c..ba9f37e5 100644 --- a/spec/suites/core/EventsSpec.js +++ b/spec/suites/core/EventsSpec.js @@ -344,22 +344,22 @@ describe('Events', function () { it('handles reentrant event firing', function () { var obj = new L.Evented(), - spy = sinon.spy(); + spy1 = sinon.spy(), + spy2 = sinon.spy(); obj .addEventListener('test1', function () { obj.fire('test2'); }) - .addEventListener('test2', function () { - // NOP, just to make sure event actually fires - }) + .addEventListener('test2', spy1) .addEventListener('test1', function () { - obj.removeEventListener('test1', spy); + obj.removeEventListener('test1', spy2); }) - .addEventListener('test1', spy); + .addEventListener('test1', spy2); obj.fireEvent('test1'); - expect(spy.called).to.be(false); + expect(spy1.called).to.be(true); + expect(spy2.called).to.be(false); }); });