umap/umap/tests/integration/test_map_list.py
Yohan Boniface 787f22efd4 WIP: rename DataLayer/Map.settings to DataLayer/Map.metadata and more
The main goal is to clarify the use of options/settings/properties…

- `settings` should be reserved to Django
- `options` should be reserved to pure Leaflet context
- `properties` used in the geojson context, for user data

Main changes:
- `DataLayer.settings` is renamed to `DataLayer.metadata`
- `DataLayer.geojson` is renamed to `Datalayer.data`
- `DataLayer.metadata` are not saved anymore in the geojson data file
- `Map.settings` is renamed to `Map.metadata`
- `Map.metadata` is now a flat key/value object, not a geojson Feature anymore
- `Map.zoom` is now populated and reused

Note: U.Map is still inheriting from Leaflet Map, so it mixes
`options` and `metadata`.

This changes is very intrusive, it changes

- the DB schema
- the way we store data in the FS (now without metadata)
- the way we backup map data

fix #1636
prepares #1335
prepares #1635
prepares #175
2024-08-27 11:24:31 +02:00

28 lines
1.2 KiB
Python

import pytest
from playwright.sync_api import expect
pytestmark = pytest.mark.django_db
def test_should_not_render_any_control(live_server, tilelayer, page, map):
map.metadata["onLoadPanel"] = "databrowser"
map.metadata["miniMap"] = True
map.metadata["captionBar"] = True
map.save()
# Make sure those controls are visible in normal view
page.goto(f"{live_server.url}{map.get_absolute_url()}")
expect(page.locator(".leaflet-control-minimap")).to_be_visible()
expect(page.locator(".umap-browser")).to_be_visible()
expect(page.locator(".umap-caption-bar")).to_be_visible()
expect(page.locator(".leaflet-control-zoom")).to_be_visible()
expect(page.locator(".leaflet-control-attribution")).to_be_visible()
# Now load home page to have the list view
page.goto(live_server.url)
map_el = page.locator(".map_fragment")
expect(map_el).to_be_visible()
expect(map_el.locator(".leaflet-control-minimap")).to_be_hidden()
expect(map_el.locator(".umap-browser")).to_be_hidden()
expect(map_el.locator(".umap-caption-bar")).to_be_hidden()
expect(map_el.locator(".leaflet-control-zoom")).to_be_hidden()
expect(map_el.locator(".leaflet-control-attribution")).to_be_hidden()