From 29547d0bd60313823770bdd94a0dc4b6f0ac4ac9 Mon Sep 17 00:00:00 2001 From: David Larlet Date: Mon, 1 May 2023 14:14:06 -0400 Subject: [PATCH] Add a test to verify marker creation at position --- umap/tests/integration/test_basics.py | 29 +++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/umap/tests/integration/test_basics.py b/umap/tests/integration/test_basics.py index 4bb545ee..9f9e6755 100644 --- a/umap/tests/integration/test_basics.py +++ b/umap/tests/integration/test_basics.py @@ -16,3 +16,32 @@ def test_create_map_link(page, live_server, lang, link_name, link_url): create_map_button = page.locator("header nav a.button") expect(create_map_button).to_have_text(link_name) expect(create_map_button).to_have_attribute("href", link_url) + + +def test_create_map_with_cursor(page, live_server): + page.goto(f"{live_server.url}/en/map/new/") + + # Click on the Draw a marker button on a new map. + create_marker_link = page.locator(".leaflet-control-toolbar ").get_by_title( + "Draw a marker" + ) + expect(create_marker_link).to_have_attribute("href", "#") + create_marker_link.click() + + # Check no marker is present by default. + marker_pane_children = page.locator(".leaflet-marker-pane > div") + expect(marker_pane_children).to_have_count(0) + + # Click on the map, it will place a marker at the given position. + map = page.locator("#map") + map.click(position={"x": 200, "y": 200}) + expect(marker_pane_children).to_have_count(1) + expect(marker_pane_children).to_have_attribute( + "style", + ( + "margin-left: -16px; " + "margin-top: -40px; " + "transform: translate3d(200px, 200px, 0px); " + "z-index: 200;" + ), + )