Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] Remove existing points from map in appendData before calling render #263

Merged
merged 2 commits into from
Jul 2, 2024

Conversation

pandafy
Copy link
Member

@pandafy pandafy commented May 27, 2024

Remove the existing points from the map in appendData before calling the render method. Otherwise,
the original points are duplicated on the map.

Remove the existing points from the map in appendData
before calling the render method. Otherwise,
the original points are duplicated on the map.
@pandafy
Copy link
Member Author

pandafy commented May 27, 2024

@nemesifier can you help me add a test for this?

I wrote this test, but the library complains that map.config.utils.appendData does not exists for the map object.

diff --git a/test/netjsongraph.render.test.js b/test/netjsongraph.render.test.js
index 1df3c00..227fd73 100644
--- a/test/netjsongraph.render.test.js
+++ b/test/netjsongraph.render.test.js
@@ -450,6 +450,23 @@ describe("Test netjsongraph GeoJSON properties", () => {
       });
     });
   });
+
+  test("appendData removes plotted points from leaflet", () => {
+    let data = {
+      type: "FeatureCollection",
+      features: [
+        {
+          type: "Feature",
+          properties: {},
+          geometry: {
+            type: "Point",
+            coordinates: [27.764892578124996, 46.01222384063236],
+          },
+        },
+      ],
+    }
+    map.config.utils.appendData(data, map);
+  });
 });
 

@pandafy pandafy changed the title [fix] Remove existing points from map in appenData before calling render [fix] Remove existing points from map in appendData before calling render May 31, 2024
@nemesifier
Copy link
Member

Merging anyway with the test coverage decreased. Will open a dedicated issue to work on increasing it.

@nemesifier nemesifier merged commit 0def491 into master Jul 2, 2024
3 of 4 checks passed
@nemesifier nemesifier deleted the fix-append-data branch July 2, 2024 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants