Add support for "center" Label position

This commit is contained in:
Yohan Boniface
2016-07-02 10:52:04 +02:00
parent 25fd9dfbd9
commit 2f4b97de19
3 changed files with 18 additions and 3 deletions

View File

@ -52,7 +52,7 @@ describe('Label', function () {
expect(map.hasLayer(layer._label)).to.be(false);
});
it("can be make interactive", function () {
it("can be made interactive", function () {
var layer = new L.Marker(center).addTo(map);
var spy = sinon.spy();
layer.on('click', spy);
@ -74,6 +74,17 @@ describe('Label', function () {
expect(spy.calledOnce).to.be(true);
});
it("can be forced on center", function () {
var layer = new L.Marker(center).addTo(map);
var spy = sinon.spy();
layer.on('click', spy);
layer.bindLabel('A label that should be displayed on the center', {permanent: true, direction: 'center', interactive: true});
expect(map.hasLayer(layer._label)).to.be(true);
happen.at('click', 150, 180); // Marker is on the map center, which is 400px large.
expect(spy.calledOnce).to.be(true);
});
it("honours opacity option", function () {
var layer = new L.Marker(center).addTo(map);
layer.bindLabel('Label', {permanent: true, opacity: 0.57});