Merge pull request #1617 from umap-project/fix-dashboard-preview

fix: dashboard preview was still calling L.U.
This commit is contained in:
Yohan Boniface 2024-02-16 14:46:12 +01:00 committed by GitHub
commit 49718c8aff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 1 deletions

View file

@ -58,7 +58,7 @@
const mapId = button.dataset.mapId const mapId = button.dataset.mapId
if (!document.querySelector(`#${mapId}_target`).hasChildNodes()) { if (!document.querySelector(`#${mapId}_target`).hasChildNodes()) {
const previewSettings = JSON.parse(document.getElementById(mapId).textContent) 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 CACHE[mapId] = map
} else { } else {
CACHE[mapId].invalidateSize() CACHE[mapId].invalidateSize()

View file

@ -23,3 +23,16 @@ def test_owner_can_delete_map_after_confirmation(map, live_server, login):
delete_button.click() delete_button.click()
assert dialog_shown assert dialog_shown
assert Map.objects.all().count() == 0 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()