"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "spec/suites/layer/TooltipSpec.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.

TooltipSpec.js  (Leaflet-1.8.0):TooltipSpec.js  (Leaflet-1.9.0)
skipping to change at line 28 skipping to change at line 28
layer.bindTooltip('Tooltip'); layer.bindTooltip('Tooltip');
happen.mouseover(layer._icon, {relatedTarget: map._container}); happen.mouseover(layer._icon, {relatedTarget: map._container});
expect(map.hasLayer(layer._tooltip)).to.be(true); expect(map.hasLayer(layer._tooltip)).to.be(true);
happen.mouseout(layer._icon, {relatedTarget: map._container}); happen.mouseout(layer._icon, {relatedTarget: map._container});
expect(map.hasLayer(layer._tooltip)).to.be(false); expect(map.hasLayer(layer._tooltip)).to.be(false);
}); });
it("opens on marker focus and closes on blur", function () {
var layer = L.marker(center).addTo(map);
layer.bindTooltip('Tooltip');
var element = layer.getElement();
happen.once(element, {type:'focus'});
expect(map.hasLayer(layer._tooltip)).to.be(true);
happen.once(element, {type:'blur'});
expect(map.hasLayer(layer._tooltip)).to.be(false);
});
it("opens on marker focus and closes on blur when first bound, then added
to map", function () {
var layer = L.marker(center);
layer.bindTooltip('Tooltip').addTo(map);
var element = layer.getElement();
happen.once(element, {type:'focus'});
expect(map.hasLayer(layer._tooltip)).to.be(true);
happen.once(element, {type:'blur'});
expect(map.hasLayer(layer._tooltip)).to.be(false);
});
it("opens on marker focus and closes on blur in layer group", function ()
{
var marker1 = L.marker([41.18, 9.45], {description: 'Marker 1'});
var marker2 = L.marker([41.18, 9.46], {description: 'Marker 2'});
var group = new L.FeatureGroup([marker1, marker2]).addTo(map);
group.bindTooltip(function (layer) {
return 'Group tooltip: ' + layer.options.description;
});
var element1 = marker1.getElement();
var element2 = marker2.getElement();
happen.once(element1, {type:'focus'});
expect(map.hasLayer(group._tooltip)).to.be(true);
expect(group._tooltip._container.innerHTML).to.be("Group tooltip:
Marker 1");
happen.once(element1, {type:'blur'});
expect(map.hasLayer(group._tooltip)).to.be(false);
happen.once(element2, {type:'focus'});
expect(map.hasLayer(group._tooltip)).to.be(true);
expect(group._tooltip._container.innerHTML).to.be("Group tooltip:
Marker 2");
happen.once(element2, {type:'blur'});
expect(map.hasLayer(group._tooltip)).to.be(false);
});
it("is mentioned in aria-describedby of a bound layer", function () {
var layer = L.marker(center).addTo(map);
layer.bindTooltip('Tooltip');
var element = layer.getElement();
happen.once(element, {type:'focus'});
var tooltip = layer.getTooltip();
expect(element.getAttribute('aria-describedby')).to.equal(tooltip
._container.id);
});
it("is mentioned in aria-describedby of a bound layer group", function ()
{
var marker1 = L.marker([41.18, 9.45], {description: 'Marker 1'});
var marker2 = L.marker([41.18, 9.46], {description: 'Marker 2'});
var group = new L.FeatureGroup([marker1, marker2]).addTo(map);
group.bindTooltip(function (layer) {
return 'Group tooltip: ' + layer.options.description;
});
var element = marker2.getElement();
happen.once(element, {type:'focus'});
var tooltip = group.getTooltip();
expect(element.getAttribute('aria-describedby')).to.equal(tooltip
._container.id);
});
it("stays open on marker when permanent", function () { it("stays open on marker when permanent", function () {
var layer = L.marker(center).addTo(map); var layer = L.marker(center).addTo(map);
layer.bindTooltip('Tooltip', {permanent: true}); layer.bindTooltip('Tooltip', {permanent: true});
expect(map.hasLayer(layer._tooltip)).to.be(true); expect(map.hasLayer(layer._tooltip)).to.be(true);
}); });
it("can be added with bindTooltip before added to the map", function () { it("can be added with bindTooltip before added to the map", function () {
var layer = L.marker(center); var layer = L.marker(center);
skipping to change at line 403 skipping to change at line 490
map.dragging.moving = function () { map.dragging.moving = function () {
return true; return true;
}; };
happen.mouseout(layer._icon, {relatedTarget: map._container}); happen.mouseout(layer._icon, {relatedTarget: map._container});
expect(tooltip.isOpen()).to.be(false); expect(tooltip.isOpen()).to.be(false);
// tooltip should not open again while dragging // tooltip should not open again while dragging
happen.at('mouseover', 210, 195); happen.at('mouseover', 210, 195);
expect(tooltip.isOpen()).to.be(false); expect(tooltip.isOpen()).to.be(false);
}); });
it("opens tooltip with passed latlng position while initializing", functi
on () {
var tooltip = new L.Tooltip(center)
.addTo(map);
expect(map.hasLayer(tooltip)).to.be(true);
});
it("opens tooltip with passed latlng and options position while initializ
ing", function () {
var tooltip = new L.Tooltip(center, {className: 'testClass'})
.addTo(map);
expect(map.hasLayer(tooltip)).to.be(true);
expect(L.DomUtil.hasClass(tooltip.getElement(), 'testClass')).to.
be(true);
});
it("adds tooltip with passed content in options while initializing", func
tion () {
var tooltip = new L.Tooltip(center, {content: 'Test'})
.addTo(map);
expect(map.hasLayer(tooltip)).to.be(true);
expect(tooltip.getContent()).to.be('Test');
});
}); });
 End of changes. 2 change blocks. 
0 lines changed or deleted 118 lines changed or added

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