Close non permanent tooltip on map click on touch (fix #4741)

This commit is contained in:
Yohan Boniface
2016-07-30 18:20:46 +02:00
parent 71d3bc02e5
commit a0ee68558f
2 changed files with 35 additions and 0 deletions

View File

@ -253,5 +253,30 @@ describe('Tooltip', function () {
expect(map.hasLayer(layer._tooltip)).to.be(true);
});
it("is opened when tapping on touch", function () {
var oldTouch = L.Browser.touch;
L.Browser.touch = true;
var layer = new L.Marker(center).addTo(map);
layer.bindTooltip('Tooltip');
expect(map.hasLayer(layer._tooltip)).to.be(false);
happen.click(layer._icon);
expect(map.hasLayer(layer._tooltip)).to.be(true);
L.Browser.touch = oldTouch;
});
it("is closed if not permanent when clicking on the map elsewhere on touch", function () {
var oldTouch = L.Browser.touch;
L.Browser.touch = true;
var layer = new L.Marker(center).addTo(map);
layer.bindTooltip('Tooltip');
happen.click(layer._icon);
expect(map.hasLayer(layer._tooltip)).to.be(true);
happen.click(map._container);
expect(map.hasLayer(layer._tooltip)).to.be(false);
L.Browser.touch = oldTouch;
});
});