"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "spec/suites/core/EventsSpec.js" between
Leaflet-1.8.0.tar.gz and Leaflet-1.9.0.tar.gz

About: Leaflet is a JavaScript library for mobile-friendly interactive maps.

EventsSpec.js  (Leaflet-1.8.0):EventsSpec.js  (Leaflet-1.9.0)
skipping to change at line 533 skipping to change at line 533
spy = sinon.spy(); spy = sinon.spy();
obj.once('test', spy, obj); obj.once('test', spy, obj);
obj.off('test', spy, obj); obj.off('test', spy, obj);
obj.fire('test'); obj.fire('test');
expect(spy.called).to.be(false); expect(spy.called).to.be(false);
}); });
it("doesn't call once twice", function () {
var obj = new L.Evented(),
spy = sinon.spy();
obj.once('test', function () {
spy();
obj.fire('test');
}, obj);
obj.fire('test');
expect(spy.calledOnce).to.be(true);
});
it('works if called from a context that doesnt implement #Events' , function () { it('works if called from a context that doesnt implement #Events' , function () {
var obj = new L.Evented(), var obj = new L.Evented(),
spy = sinon.spy(), spy = sinon.spy(),
foo = {}; foo = {};
obj.once('test', spy, foo); obj.once('test', spy, foo);
obj.fire('test'); obj.fire('test');
expect(spy.called).to.be(true); expect(spy.called).to.be(true);
skipping to change at line 662 skipping to change at line 675
it('changes for a "once" handler', function () { it('changes for a "once" handler', function () {
var obj = new L.Evented(), var obj = new L.Evented(),
spy = sinon.spy(); spy = sinon.spy();
obj.once('test', spy); obj.once('test', spy);
expect(obj.listens('test')).to.be(true); expect(obj.listens('test')).to.be(true);
obj.fire('test'); obj.fire('test');
expect(obj.listens('test')).to.be(false); expect(obj.listens('test')).to.be(false);
}); });
it('returns true if event handler with specific function and cont
ext is existing', function () {
var obj = new L.Evented(),
differentContext = new L.Evented(),
spy = sinon.spy(),
diffentFnc = sinon.spy();
obj.on('test', spy);
// event handler 'test' is existing
expect(obj.listens('test')).to.be(true);
// event handler with specific function is existing
expect(obj.listens('test', spy)).to.be(true); // context
arg: undefined === this
expect(obj.listens('test', spy, obj)).to.be(true);
// event handler with specific function and other context
is not existing
expect(obj.listens('test', spy, differentContext)).to.be(
false);
// event handler with specific function is not existing
expect(obj.listens('test', diffentFnc)).to.be(false);
});
it('is true if there is an event handler on parent', function ()
{
var fg = L.featureGroup(),
marker = L.marker([0, 0]).addTo(fg),
spy = sinon.spy();
fg.on('test', spy);
expect(marker.listens('test', false)).to.be(false);
expect(marker.listens('test', true)).to.be(true);
});
it('is true if there is an event handler with specific function o
n parent', function () {
var fg = L.featureGroup(),
marker = L.marker([0, 0]).addTo(fg),
spy = sinon.spy();
fg.on('test', spy);
expect(marker.listens('test', spy, marker, false)).to.be(
false);
expect(marker.listens('test', spy, marker, true)).to.be(f
alse);
expect(marker.listens('test', spy, fg, false)).to.be(fals
e);
expect(marker.listens('test', spy, fg, true)).to.be(true)
;
});
}); });
describe('#L.Mixin.Events', function () { describe('#L.Mixin.Events', function () {
it('can be used from includes', function () { it('can be used from includes', function () {
var EventClass = L.Class.extend({ var EventClass = L.Class.extend({
includes: L.Mixin.Events includes: L.Mixin.Events
}); });
var obj = new EventClass(); var obj = new EventClass();
var spy = sinon.spy(); var spy = sinon.spy();
 End of changes. 2 change blocks. 
0 lines changed or deleted 67 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)