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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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 added this to To do (general) in OpenWISP Contributor's Board via automation May 27, 2024
@pandafy pandafy moved this from To do (general) to Needs review in OpenWISP Contributor's Board May 27, 2024
@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants