polylines tooltip content

This commit is contained in:
ISA
2024-08-10 10:32:37 +02:00
parent b1f7b700ca
commit b7116a1e6f
142 changed files with 14451 additions and 4281 deletions

View File

@@ -0,0 +1,40 @@
// __tests__/components/gisPolylines/icons/CircleIcon.test.js
jest.mock("leaflet", () => {
const actualLeaflet = jest.requireActual("leaflet");
return {
...actualLeaflet,
DivIcon: jest.fn().mockImplementation((options) => ({
...options,
options,
_leaflet_id: Math.random(),
})),
};
});
import L from "leaflet";
import CircleIcon from "../../../components/gisPolylines/icons/CircleIcon";
describe("CircleIcon", () => {
test("should be a Leaflet divIcon with correct properties", () => {
// console.log("CircleIcon options:", CircleIcon.options);
expect(CircleIcon).toEqual(
expect.objectContaining({
options: expect.objectContaining({
className: "custom-circle-icon leaflet-marker-icon",
html: '<div style="background-color:gray; width:10px; height:10px; border-radius:50%; border: solid black 1px;"></div>',
iconSize: [25, 25],
iconAnchor: [5, 5],
}),
})
);
expect(CircleIcon.options.className).toContain("custom-circle-icon");
expect(CircleIcon.options.html).toContain("<div");
expect(CircleIcon.options.html).toContain("background-color:gray");
expect(CircleIcon.options.html).toContain("border-radius:50%");
expect(CircleIcon.options.html).toContain("width:10px");
expect(CircleIcon.options.html).toContain("height:10px");
expect(CircleIcon.options.html).toContain("border: solid black 1px");
expect(CircleIcon.options.iconSize).toEqual([25, 25]);
expect(CircleIcon.options.iconAnchor).toEqual([5, 5]);
});
});