From 434a2928780149b9561fecd61113be684b931787 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Fri, 16 Feb 2024 12:36:05 +0100 Subject: [PATCH] fix: dashboard preview was still calling L.U. --- umap/templates/umap/user_dashboard.html | 2 +- umap/tests/integration/test_dashboard.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/umap/templates/umap/user_dashboard.html b/umap/templates/umap/user_dashboard.html index 2f886a2d..9e4f5d10 100644 --- a/umap/templates/umap/user_dashboard.html +++ b/umap/templates/umap/user_dashboard.html @@ -58,7 +58,7 @@ const mapId = button.dataset.mapId if (!document.querySelector(`#${mapId}_target`).hasChildNodes()) { const previewSettings = JSON.parse(document.getElementById(mapId).textContent) - const map = new L.U.Map(`${mapId}_target`, previewSettings) + const map = new U.Map(`${mapId}_target`, previewSettings) CACHE[mapId] = map } else { CACHE[mapId].invalidateSize() diff --git a/umap/tests/integration/test_dashboard.py b/umap/tests/integration/test_dashboard.py index cb6559ff..0355eb67 100644 --- a/umap/tests/integration/test_dashboard.py +++ b/umap/tests/integration/test_dashboard.py @@ -23,3 +23,16 @@ def test_owner_can_delete_map_after_confirmation(map, live_server, login): delete_button.click() assert dialog_shown assert Map.objects.all().count() == 0 + + +def test_dashboard_map_preview(map, live_server, datalayer, login): + page = login(map.owner) + page.goto(f"{live_server.url}/en/me") + dialog = page.locator("dialog") + expect(dialog).to_be_hidden() + button = page.get_by_role("button", name="Open preview") + expect(button).to_be_visible() + button.click() + expect(dialog).to_be_visible() + # Let's check we have a marker on it, so we can guess the map loaded correctly + expect(dialog.locator(".leaflet-marker-icon")).to_be_visible()