fix: dashboard preview was still calling L.U.

This commit is contained in:
Yohan Boniface 2024-02-16 12:36:05 +01:00
parent 3f3392952c
commit 434a292878
2 changed files with 14 additions and 1 deletions

View file

@ -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()

View file

@ -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()