umap-project 2.1.3__py3-none-any.whl → 2.2.0b0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of umap-project might be problematic. Click here for more details.
- umap/__init__.py +1 -1
- umap/context_processors.py +1 -0
- umap/locale/br/LC_MESSAGES/django.mo +0 -0
- umap/locale/en/LC_MESSAGES/django.po +32 -32
- umap/locale/hu/LC_MESSAGES/django.mo +0 -0
- umap/locale/it/LC_MESSAGES/django.mo +0 -0
- umap/locale/ms/LC_MESSAGES/django.mo +0 -0
- umap/migrations/0020_alter_tilelayer_url_template.py +19 -0
- umap/migrations/0021_remove_map_description.py +16 -0
- umap/models.py +8 -6
- umap/settings/base.py +1 -0
- umap/static/umap/base.css +29 -151
- umap/static/umap/content.css +7 -25
- umap/static/umap/css/icon.css +112 -0
- umap/static/umap/css/panel.css +140 -0
- umap/static/umap/img/16-white.svg +5 -1
- umap/static/umap/img/16.svg +7 -4
- umap/static/umap/img/24-white.svg +3 -1
- umap/static/umap/img/24.svg +3 -4
- umap/static/umap/img/source/16-white.svg +176 -940
- umap/static/umap/img/source/16.svg +8 -5
- umap/static/umap/img/source/24-white.svg +5 -3
- umap/static/umap/img/source/24.svg +6 -7
- umap/static/umap/js/modules/browser.js +82 -73
- umap/static/umap/js/modules/dompurify.js +12 -0
- umap/static/umap/js/modules/facets.js +148 -0
- umap/static/umap/js/modules/global.js +9 -1
- umap/static/umap/js/modules/i18n.js +7 -0
- umap/static/umap/js/modules/orderable.js +84 -0
- umap/static/umap/js/modules/panel.js +76 -0
- umap/static/umap/js/modules/request.js +0 -1
- umap/static/umap/js/modules/schema.js +324 -223
- umap/static/umap/js/modules/urls.js +1 -16
- umap/static/umap/js/modules/utils.js +340 -0
- umap/static/umap/js/umap.controls.js +183 -330
- umap/static/umap/js/umap.core.js +60 -364
- umap/static/umap/js/umap.datalayer.permissions.js +1 -1
- umap/static/umap/js/umap.features.js +60 -40
- umap/static/umap/js/umap.forms.js +111 -25
- umap/static/umap/js/umap.icon.js +11 -4
- umap/static/umap/js/umap.importer.js +24 -17
- umap/static/umap/js/umap.js +170 -145
- umap/static/umap/js/umap.layer.js +71 -40
- umap/static/umap/js/umap.permissions.js +9 -11
- umap/static/umap/js/umap.popup.js +10 -21
- umap/static/umap/js/umap.share.js +11 -8
- umap/static/umap/js/umap.tableeditor.js +4 -6
- umap/static/umap/js/umap.ui.js +0 -51
- umap/static/umap/locale/am_ET.js +242 -227
- umap/static/umap/locale/am_ET.json +18 -7
- umap/static/umap/locale/ar.js +242 -227
- umap/static/umap/locale/ar.json +18 -7
- umap/static/umap/locale/ast.js +242 -227
- umap/static/umap/locale/ast.json +18 -7
- umap/static/umap/locale/bg.js +242 -227
- umap/static/umap/locale/bg.json +18 -7
- umap/static/umap/locale/br.js +252 -237
- umap/static/umap/locale/br.json +22 -11
- umap/static/umap/locale/ca.js +242 -227
- umap/static/umap/locale/ca.json +18 -7
- umap/static/umap/locale/cs_CZ.js +242 -227
- umap/static/umap/locale/cs_CZ.json +18 -7
- umap/static/umap/locale/da.js +242 -227
- umap/static/umap/locale/da.json +18 -7
- umap/static/umap/locale/de.js +242 -227
- umap/static/umap/locale/de.json +18 -7
- umap/static/umap/locale/el.js +242 -227
- umap/static/umap/locale/el.json +18 -7
- umap/static/umap/locale/en.js +242 -234
- umap/static/umap/locale/en.json +19 -8
- umap/static/umap/locale/en_US.json +18 -7
- umap/static/umap/locale/es.js +242 -227
- umap/static/umap/locale/es.json +18 -7
- umap/static/umap/locale/et.js +242 -227
- umap/static/umap/locale/et.json +18 -7
- umap/static/umap/locale/eu.js +227 -199
- umap/static/umap/locale/eu.json +1 -1
- umap/static/umap/locale/fa_IR.js +242 -227
- umap/static/umap/locale/fa_IR.json +18 -7
- umap/static/umap/locale/fi.js +242 -227
- umap/static/umap/locale/fi.json +18 -7
- umap/static/umap/locale/fr.js +242 -234
- umap/static/umap/locale/fr.json +18 -7
- umap/static/umap/locale/gl.js +242 -227
- umap/static/umap/locale/gl.json +18 -7
- umap/static/umap/locale/he.js +242 -227
- umap/static/umap/locale/he.json +18 -7
- umap/static/umap/locale/hr.js +242 -227
- umap/static/umap/locale/hr.json +18 -7
- umap/static/umap/locale/hu.js +242 -234
- umap/static/umap/locale/hu.json +18 -7
- umap/static/umap/locale/id.js +242 -227
- umap/static/umap/locale/id.json +18 -7
- umap/static/umap/locale/is.js +242 -227
- umap/static/umap/locale/is.json +18 -7
- umap/static/umap/locale/it.js +242 -234
- umap/static/umap/locale/it.json +18 -7
- umap/static/umap/locale/ja.js +242 -227
- umap/static/umap/locale/ja.json +18 -7
- umap/static/umap/locale/ko.js +242 -227
- umap/static/umap/locale/ko.json +18 -7
- umap/static/umap/locale/lt.js +242 -227
- umap/static/umap/locale/lt.json +18 -7
- umap/static/umap/locale/ms.js +242 -234
- umap/static/umap/locale/ms.json +19 -8
- umap/static/umap/locale/nl.js +245 -230
- umap/static/umap/locale/nl.json +18 -7
- umap/static/umap/locale/no.js +242 -227
- umap/static/umap/locale/no.json +18 -7
- umap/static/umap/locale/pl.js +242 -227
- umap/static/umap/locale/pl.json +18 -7
- umap/static/umap/locale/pl_PL.json +18 -7
- umap/static/umap/locale/pt.js +242 -227
- umap/static/umap/locale/pt.json +18 -7
- umap/static/umap/locale/pt_BR.js +242 -227
- umap/static/umap/locale/pt_BR.json +18 -7
- umap/static/umap/locale/pt_PT.js +242 -227
- umap/static/umap/locale/pt_PT.json +18 -7
- umap/static/umap/locale/ro.js +242 -227
- umap/static/umap/locale/ro.json +18 -7
- umap/static/umap/locale/ru.js +242 -227
- umap/static/umap/locale/ru.json +18 -7
- umap/static/umap/locale/si.js +1 -1
- umap/static/umap/locale/si.json +1 -1
- umap/static/umap/locale/sk_SK.js +242 -227
- umap/static/umap/locale/sk_SK.json +18 -7
- umap/static/umap/locale/sl.js +242 -227
- umap/static/umap/locale/sl.json +18 -7
- umap/static/umap/locale/sr.js +242 -227
- umap/static/umap/locale/sr.json +18 -7
- umap/static/umap/locale/sv.js +242 -227
- umap/static/umap/locale/sv.json +18 -7
- umap/static/umap/locale/th_TH.js +242 -227
- umap/static/umap/locale/th_TH.json +18 -7
- umap/static/umap/locale/tr.js +242 -227
- umap/static/umap/locale/tr.json +18 -7
- umap/static/umap/locale/uk_UA.js +242 -227
- umap/static/umap/locale/uk_UA.json +18 -7
- umap/static/umap/locale/vi.js +242 -227
- umap/static/umap/locale/vi.json +18 -7
- umap/static/umap/locale/vi_VN.json +18 -7
- umap/static/umap/locale/zh.js +242 -227
- umap/static/umap/locale/zh.json +18 -7
- umap/static/umap/locale/zh_CN.json +18 -7
- umap/static/umap/locale/zh_TW.Big5.json +18 -7
- umap/static/umap/locale/zh_TW.js +242 -234
- umap/static/umap/locale/zh_TW.json +18 -7
- umap/static/umap/map.css +114 -265
- umap/static/umap/test/DataLayer.js +463 -0
- umap/static/umap/test/Feature.js +0 -226
- umap/static/umap/test/TableEditor.js +104 -0
- umap/static/umap/test/Util.js +0 -521
- umap/static/umap/test/index.html +0 -1
- umap/static/umap/unittests/URLs.js +1 -1
- umap/static/umap/unittests/utils.js +610 -0
- umap/static/umap/vars.css +9 -0
- umap/static/umap/vendors/dompurify/purify.es.mjs +1525 -0
- umap/static/umap/vendors/iconlayers/iconLayers.js +1 -1
- umap/templates/umap/css.html +2 -0
- umap/templates/umap/js.html +0 -1
- umap/templates/umap/map_detail.html +4 -0
- umap/templates/umap/map_table.html +12 -10
- umap/templatetags/umap_tags.py +5 -0
- umap/tests/integration/conftest.py +12 -1
- umap/tests/integration/test_anonymous_owned_map.py +6 -5
- umap/tests/integration/test_browser.py +12 -25
- umap/tests/integration/test_choropleth.py +1 -1
- umap/tests/integration/test_dashboard.py +10 -0
- umap/tests/integration/test_datalayer.py +8 -6
- umap/tests/integration/test_edit_datalayer.py +24 -19
- umap/tests/integration/test_edit_map.py +182 -2
- umap/tests/integration/test_edit_marker.py +120 -0
- umap/tests/integration/test_edit_polygon.py +122 -0
- umap/tests/integration/test_facets_browser.py +104 -14
- umap/tests/integration/test_import.py +70 -20
- umap/tests/integration/test_map.py +19 -17
- umap/tests/integration/test_map_list.py +28 -0
- umap/tests/integration/test_owned_map.py +10 -10
- umap/tests/integration/test_picto.py +5 -5
- umap/tests/integration/test_querystring.py +9 -15
- umap/tests/integration/test_slideshow.py +0 -5
- umap/tests/integration/test_statics.py +3 -2
- umap/tests/integration/test_tableeditor.py +1 -5
- umap/tests/integration/test_view_marker.py +64 -0
- umap/tests/integration/test_view_polygon.py +59 -0
- umap/tests/integration/test_view_polyline.py +51 -0
- umap/tests/test_map_views.py +13 -0
- {umap_project-2.1.3.dist-info → umap_project-2.2.0b0.dist-info}/METADATA +8 -8
- {umap_project-2.1.3.dist-info → umap_project-2.2.0b0.dist-info}/RECORD +194 -178
- umap/static/umap/vendors/dompurify/purify.min.js +0 -3
- umap/static/umap/vendors/dompurify/purify.min.js.map +0 -1
- /umap/tests/integration/{test_polygon.py → test_draw_polygon.py} +0 -0
- /umap/tests/integration/{test_polyline.py → test_draw_polyline.py} +0 -0
- {umap_project-2.1.3.dist-info → umap_project-2.2.0b0.dist-info}/WHEEL +0 -0
- {umap_project-2.1.3.dist-info → umap_project-2.2.0b0.dist-info}/entry_points.txt +0 -0
- {umap_project-2.1.3.dist-info → umap_project-2.2.0b0.dist-info}/licenses/LICENSE +0 -0
|
@@ -42,10 +42,10 @@ def test_default_view_without_datalayer_should_use_default_center(
|
|
|
42
42
|
):
|
|
43
43
|
datalayer.settings["displayOnLoad"] = False
|
|
44
44
|
datalayer.save()
|
|
45
|
-
page.goto(f"{live_server.url}{map.get_absolute_url()}")
|
|
45
|
+
page.goto(f"{live_server.url}{map.get_absolute_url()}?onLoadPanel=datalayers")
|
|
46
46
|
# Hash is defined, so map is initialized
|
|
47
47
|
expect(page).to_have_url(re.compile(r".*#7/48\..+/13\..+"))
|
|
48
|
-
layers = page.locator(".umap-
|
|
48
|
+
layers = page.locator(".umap-browser .datalayer h5")
|
|
49
49
|
expect(layers).to_have_count(1)
|
|
50
50
|
|
|
51
51
|
|
|
@@ -56,10 +56,10 @@ def test_default_view_latest_without_datalayer_should_use_default_center(
|
|
|
56
56
|
datalayer.save()
|
|
57
57
|
map.settings["properties"]["defaultView"] = "latest"
|
|
58
58
|
map.save()
|
|
59
|
-
page.goto(f"{live_server.url}{map.get_absolute_url()}")
|
|
59
|
+
page.goto(f"{live_server.url}{map.get_absolute_url()}?onLoadPanel=datalayers")
|
|
60
60
|
# Hash is defined, so map is initialized
|
|
61
61
|
expect(page).to_have_url(re.compile(r".*#7/48\..+/13\..+"))
|
|
62
|
-
layers = page.locator(".umap-
|
|
62
|
+
layers = page.locator(".umap-browser .datalayer h5")
|
|
63
63
|
expect(layers).to_have_count(1)
|
|
64
64
|
|
|
65
65
|
|
|
@@ -70,21 +70,22 @@ def test_default_view_data_without_datalayer_should_use_default_center(
|
|
|
70
70
|
datalayer.save()
|
|
71
71
|
map.settings["properties"]["defaultView"] = "data"
|
|
72
72
|
map.save()
|
|
73
|
-
page.goto(f"{live_server.url}{map.get_absolute_url()}")
|
|
73
|
+
page.goto(f"{live_server.url}{map.get_absolute_url()}?onLoadPanel=datalayers")
|
|
74
74
|
# Hash is defined, so map is initialized
|
|
75
75
|
expect(page).to_have_url(re.compile(r".*#7/48\..+/13\..+"))
|
|
76
|
-
layers = page.locator(".umap-
|
|
76
|
+
layers = page.locator(".umap-browser .datalayer h5")
|
|
77
77
|
expect(layers).to_have_count(1)
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
def test_default_view_latest_with_marker(map, live_server, datalayer, page):
|
|
81
81
|
map.settings["properties"]["defaultView"] = "latest"
|
|
82
82
|
map.save()
|
|
83
|
-
page.goto(f"{live_server.url}{map.get_absolute_url()}")
|
|
83
|
+
page.goto(f"{live_server.url}{map.get_absolute_url()}?onLoadPanel=datalayers")
|
|
84
84
|
# Hash is defined, so map is initialized
|
|
85
85
|
expect(page).to_have_url(re.compile(r".*#7/48\..+/14\..+"))
|
|
86
|
-
layers = page.locator(".umap-
|
|
86
|
+
layers = page.locator(".umap-browser .datalayer h5")
|
|
87
87
|
expect(layers).to_have_count(1)
|
|
88
|
+
expect(page.locator(".leaflet-popup")).to_be_visible()
|
|
88
89
|
|
|
89
90
|
|
|
90
91
|
def test_default_view_latest_with_line(map, live_server, page):
|
|
@@ -109,9 +110,9 @@ def test_default_view_latest_with_line(map, live_server, page):
|
|
|
109
110
|
DataLayerFactory(map=map, data=data)
|
|
110
111
|
map.settings["properties"]["defaultView"] = "latest"
|
|
111
112
|
map.save()
|
|
112
|
-
page.goto(f"{live_server.url}{map.get_absolute_url()}")
|
|
113
|
+
page.goto(f"{live_server.url}{map.get_absolute_url()}?onLoadPanel=datalayers")
|
|
113
114
|
expect(page).to_have_url(re.compile(r".*#8/48\..+/2\..+"))
|
|
114
|
-
layers = page.locator(".umap-
|
|
115
|
+
layers = page.locator(".umap-browser .datalayer h5")
|
|
115
116
|
expect(layers).to_have_count(1)
|
|
116
117
|
|
|
117
118
|
|
|
@@ -140,9 +141,9 @@ def test_default_view_latest_with_polygon(map, live_server, page):
|
|
|
140
141
|
DataLayerFactory(map=map, data=data)
|
|
141
142
|
map.settings["properties"]["defaultView"] = "latest"
|
|
142
143
|
map.save()
|
|
143
|
-
page.goto(f"{live_server.url}{map.get_absolute_url()}")
|
|
144
|
+
page.goto(f"{live_server.url}{map.get_absolute_url()}?onLoadPanel=datalayers")
|
|
144
145
|
expect(page).to_have_url(re.compile(r".*#8/48\..+/2\..+"))
|
|
145
|
-
layers = page.locator(".umap-
|
|
146
|
+
layers = page.locator(".umap-browser .datalayer h5")
|
|
146
147
|
expect(layers).to_have_count(1)
|
|
147
148
|
|
|
148
149
|
|
|
@@ -168,10 +169,10 @@ def test_remote_layer_should_not_be_used_as_datalayer_for_created_features(
|
|
|
168
169
|
}
|
|
169
170
|
datalayer.save()
|
|
170
171
|
page.goto(f"{live_server.url}{openmap.get_absolute_url()}?edit")
|
|
171
|
-
toggle = page.get_by_role("button", name="See
|
|
172
|
+
toggle = page.get_by_role("button", name="See layers")
|
|
172
173
|
expect(toggle).to_be_visible()
|
|
173
174
|
toggle.click()
|
|
174
|
-
layers = page.locator(".umap-
|
|
175
|
+
layers = page.locator(".umap-browser .datalayer h5")
|
|
175
176
|
expect(layers).to_have_count(1)
|
|
176
177
|
map_el = page.locator("#map")
|
|
177
178
|
add_marker = page.get_by_title("Draw a marker")
|
|
@@ -179,10 +180,11 @@ def test_remote_layer_should_not_be_used_as_datalayer_for_created_features(
|
|
|
179
180
|
marker = page.locator(".leaflet-marker-icon")
|
|
180
181
|
expect(marker).to_have_count(0)
|
|
181
182
|
add_marker.click()
|
|
182
|
-
map_el.click(position={"x":
|
|
183
|
+
map_el.click(position={"x": 500, "y": 100})
|
|
183
184
|
expect(marker).to_have_count(1)
|
|
184
185
|
# A new datalayer has been created to host this created feature
|
|
185
186
|
# given the remote one cannot accept new features
|
|
187
|
+
page.get_by_title("See layers").click()
|
|
186
188
|
expect(layers).to_have_count(2)
|
|
187
189
|
|
|
188
190
|
|
|
@@ -195,9 +197,9 @@ def test_can_hide_datalayer_from_caption(openmap, live_server, datalayer, page):
|
|
|
195
197
|
toggle.click()
|
|
196
198
|
layers = page.locator(".umap-caption .datalayer-legend")
|
|
197
199
|
expect(layers).to_have_count(1)
|
|
198
|
-
found = page.locator("
|
|
200
|
+
found = page.locator(".panel.left.on").get_by_text(datalayer.name)
|
|
199
201
|
expect(found).to_be_visible()
|
|
200
|
-
hidden = page.locator("
|
|
202
|
+
hidden = page.locator(".panel.left.on").get_by_text(other.name)
|
|
201
203
|
expect(hidden).to_be_hidden()
|
|
202
204
|
|
|
203
205
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from playwright.sync_api import expect
|
|
3
|
+
|
|
4
|
+
pytestmark = pytest.mark.django_db
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def test_should_not_render_any_control(live_server, tilelayer, page, map):
|
|
8
|
+
map.settings["properties"]["onLoadPanel"] = "databrowser"
|
|
9
|
+
map.settings["properties"]["miniMap"] = True
|
|
10
|
+
map.settings["properties"]["captionBar"] = True
|
|
11
|
+
map.save()
|
|
12
|
+
# Make sure those controls are visible in normal view
|
|
13
|
+
page.goto(f"{live_server.url}{map.get_absolute_url()}")
|
|
14
|
+
expect(page.locator(".leaflet-control-minimap")).to_be_visible()
|
|
15
|
+
expect(page.locator(".umap-browser")).to_be_visible()
|
|
16
|
+
expect(page.locator(".umap-caption-bar")).to_be_visible()
|
|
17
|
+
expect(page.locator(".leaflet-control-zoom")).to_be_visible()
|
|
18
|
+
expect(page.locator(".leaflet-control-attribution")).to_be_visible()
|
|
19
|
+
|
|
20
|
+
# Now load home page to have the list view
|
|
21
|
+
page.goto(live_server.url)
|
|
22
|
+
map_el = page.locator(".map_fragment")
|
|
23
|
+
expect(map_el).to_be_visible()
|
|
24
|
+
expect(map_el.locator(".leaflet-control-minimap")).to_be_hidden()
|
|
25
|
+
expect(map_el.locator(".umap-browser")).to_be_hidden()
|
|
26
|
+
expect(map_el.locator(".umap-caption-bar")).to_be_hidden()
|
|
27
|
+
expect(map_el.locator(".leaflet-control-zoom")).to_be_hidden()
|
|
28
|
+
expect(map_el.locator(".leaflet-control-attribution")).to_be_hidden()
|
|
@@ -22,7 +22,7 @@ def test_map_update_with_owner(map, live_server, login):
|
|
|
22
22
|
expect(save).to_be_visible()
|
|
23
23
|
add_marker = page.get_by_title("Draw a marker")
|
|
24
24
|
expect(add_marker).to_be_visible()
|
|
25
|
-
edit_settings = page.get_by_title("
|
|
25
|
+
edit_settings = page.get_by_title("Map advanced properties")
|
|
26
26
|
expect(edit_settings).to_be_visible()
|
|
27
27
|
edit_permissions = page.get_by_title("Update permissions and editors")
|
|
28
28
|
expect(edit_permissions).to_be_visible()
|
|
@@ -49,7 +49,7 @@ def test_map_update_with_anonymous_but_editable_datalayer(
|
|
|
49
49
|
enable.click()
|
|
50
50
|
add_marker = page.get_by_title("Draw a marker")
|
|
51
51
|
expect(add_marker).to_be_visible()
|
|
52
|
-
edit_settings = page.get_by_title("
|
|
52
|
+
edit_settings = page.get_by_title("Map advanced properties")
|
|
53
53
|
expect(edit_settings).to_be_hidden()
|
|
54
54
|
edit_permissions = page.get_by_title("Update permissions and editors")
|
|
55
55
|
expect(edit_permissions).to_be_hidden()
|
|
@@ -97,7 +97,7 @@ def test_map_update_with_editor(map, live_server, login, user):
|
|
|
97
97
|
expect(save).to_be_visible()
|
|
98
98
|
add_marker = page.get_by_title("Draw a marker")
|
|
99
99
|
expect(add_marker).to_be_visible()
|
|
100
|
-
edit_settings = page.get_by_title("
|
|
100
|
+
edit_settings = page.get_by_title("Map advanced properties")
|
|
101
101
|
expect(edit_settings).to_be_visible()
|
|
102
102
|
edit_permissions = page.get_by_title("Update permissions and editors")
|
|
103
103
|
expect(edit_permissions).to_be_visible()
|
|
@@ -126,7 +126,7 @@ def test_permissions_form_with_editor(map, datalayer, live_server, login, user):
|
|
|
126
126
|
def test_owner_has_delete_map_button(map, live_server, login):
|
|
127
127
|
page = login(map.owner)
|
|
128
128
|
page.goto(f"{live_server.url}{map.get_absolute_url()}?edit")
|
|
129
|
-
settings = page.get_by_title("
|
|
129
|
+
settings = page.get_by_title("Map advanced properties")
|
|
130
130
|
expect(settings).to_be_visible()
|
|
131
131
|
settings.click()
|
|
132
132
|
advanced = page.get_by_text("Advanced actions")
|
|
@@ -154,7 +154,7 @@ def test_editor_do_not_have_delete_map_button(map, live_server, login, user):
|
|
|
154
154
|
map.save()
|
|
155
155
|
page = login(user)
|
|
156
156
|
page.goto(f"{live_server.url}{map.get_absolute_url()}?edit")
|
|
157
|
-
settings = page.get_by_title("
|
|
157
|
+
settings = page.get_by_title("Map advanced properties")
|
|
158
158
|
expect(settings).to_be_visible()
|
|
159
159
|
settings.click()
|
|
160
160
|
advanced = page.get_by_text("Advanced actions")
|
|
@@ -187,7 +187,7 @@ def test_can_change_perms_after_create(tilelayer, live_server, login, user):
|
|
|
187
187
|
page.goto(f"{live_server.url}/en/map/new")
|
|
188
188
|
# Create a layer
|
|
189
189
|
page.get_by_title("Manage layers").click()
|
|
190
|
-
page.
|
|
190
|
+
page.get_by_title("Add a layer").click()
|
|
191
191
|
page.locator("input[name=name]").fill("Layer 1")
|
|
192
192
|
save = page.get_by_role("button", name="Save")
|
|
193
193
|
expect(save).to_be_visible()
|
|
@@ -236,16 +236,16 @@ def test_can_change_owner(map, live_server, login, user):
|
|
|
236
236
|
def test_can_delete_datalayer(live_server, map, login, datalayer):
|
|
237
237
|
page = login(map.owner)
|
|
238
238
|
page.goto(f"{live_server.url}{map.get_absolute_url()}?edit")
|
|
239
|
-
|
|
239
|
+
page.get_by_title("See layers").click()
|
|
240
|
+
layers = page.locator(".umap-browser .datalayer")
|
|
240
241
|
markers = page.locator(".leaflet-marker-icon")
|
|
241
242
|
expect(layers).to_have_count(1)
|
|
242
243
|
expect(markers).to_have_count(1)
|
|
243
244
|
page.get_by_role("link", name="Manage layers").click()
|
|
244
245
|
page.once("dialog", lambda dialog: dialog.accept())
|
|
245
|
-
page.locator("
|
|
246
|
+
page.locator(".panel.right").get_by_title("Delete layer").click()
|
|
246
247
|
with page.expect_response(re.compile(r".*/datalayer/delete/.*")):
|
|
247
248
|
page.get_by_role("button", name="Save").click()
|
|
248
249
|
expect(markers).to_have_count(0)
|
|
249
250
|
# FIXME does not work, resolve to 1 element, even if this command is empty:
|
|
250
|
-
|
|
251
|
-
# expect(layers).to_have_count(0)
|
|
251
|
+
expect(layers).to_have_count(0)
|
|
@@ -44,7 +44,7 @@ def test_can_change_picto_at_map_level(openmap, live_server, page, pictos):
|
|
|
44
44
|
expect(marker).to_have_count(1)
|
|
45
45
|
# Should have default img
|
|
46
46
|
expect(marker).to_have_attribute("src", "/static/umap/img/marker.svg")
|
|
47
|
-
edit_settings = page.get_by_title("
|
|
47
|
+
edit_settings = page.get_by_title("Map advanced properties")
|
|
48
48
|
expect(edit_settings).to_be_visible()
|
|
49
49
|
edit_settings.click()
|
|
50
50
|
shape_settings = page.get_by_text("Default shape properties")
|
|
@@ -152,7 +152,7 @@ def test_can_use_remote_url_as_picto(openmap, live_server, page, pictos):
|
|
|
152
152
|
expect(marker).to_have_count(1)
|
|
153
153
|
# Should have default img
|
|
154
154
|
expect(marker).to_have_attribute("src", "/static/umap/img/marker.svg")
|
|
155
|
-
edit_settings = page.get_by_title("
|
|
155
|
+
edit_settings = page.get_by_title("Map advanced properties")
|
|
156
156
|
expect(edit_settings).to_be_visible()
|
|
157
157
|
edit_settings.click()
|
|
158
158
|
shape_settings = page.get_by_text("Default shape properties")
|
|
@@ -171,7 +171,7 @@ def test_can_use_remote_url_as_picto(openmap, live_server, page, pictos):
|
|
|
171
171
|
input_el.blur()
|
|
172
172
|
expect(marker).to_have_attribute("src", "https://foo.bar/img.jpg")
|
|
173
173
|
# Now close and reopen the form, it should still be the URL tab
|
|
174
|
-
close = page.locator("
|
|
174
|
+
close = page.locator(".panel.right.on .toolbox").get_by_title("Close")
|
|
175
175
|
expect(close).to_be_visible()
|
|
176
176
|
close.click()
|
|
177
177
|
edit_settings.click()
|
|
@@ -191,7 +191,7 @@ def test_can_use_char_as_picto(openmap, live_server, page, pictos):
|
|
|
191
191
|
marker = page.locator(".umap-div-icon span")
|
|
192
192
|
# Should have default img, so not a span
|
|
193
193
|
expect(marker).to_have_count(0)
|
|
194
|
-
edit_settings = page.get_by_title("
|
|
194
|
+
edit_settings = page.get_by_title("Map advanced properties")
|
|
195
195
|
expect(edit_settings).to_be_visible()
|
|
196
196
|
edit_settings.click()
|
|
197
197
|
shape_settings = page.get_by_text("Default shape properties")
|
|
@@ -210,7 +210,7 @@ def test_can_use_char_as_picto(openmap, live_server, page, pictos):
|
|
|
210
210
|
expect(marker).to_have_count(1)
|
|
211
211
|
expect(marker).to_have_text("♩")
|
|
212
212
|
# Now close and reopen the form, it should still be the URL tab
|
|
213
|
-
close = page.locator("
|
|
213
|
+
close = page.locator(".panel.right.on .toolbox").get_by_title("Close")
|
|
214
214
|
expect(close).to_be_visible()
|
|
215
215
|
close.click()
|
|
216
216
|
edit_settings.click()
|
|
@@ -15,30 +15,24 @@ def test_scale_control(map, live_server, datalayer, page):
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
def test_datalayers_control(map, live_server, datalayer, page):
|
|
18
|
-
control = page.locator(".umap-browse
|
|
19
|
-
|
|
20
|
-
more = page.get_by_title("More controls")
|
|
18
|
+
control = page.locator(".umap-control-browse")
|
|
19
|
+
browser = page.locator(".umap-browser")
|
|
21
20
|
page.goto(f"{live_server.url}{map.get_absolute_url()}")
|
|
22
21
|
expect(control).to_be_visible()
|
|
23
|
-
expect(
|
|
22
|
+
expect(browser).to_be_hidden()
|
|
24
23
|
page.goto(f"{live_server.url}{map.get_absolute_url()}?datalayersControl=true")
|
|
25
24
|
expect(control).to_be_visible()
|
|
26
|
-
expect(
|
|
25
|
+
expect(browser).to_be_hidden()
|
|
27
26
|
page.goto(f"{live_server.url}{map.get_absolute_url()}?datalayersControl=null")
|
|
28
27
|
expect(control).to_be_hidden()
|
|
29
|
-
expect(
|
|
30
|
-
more.click()
|
|
31
|
-
expect(control).to_be_visible()
|
|
32
|
-
expect(box).to_be_hidden()
|
|
28
|
+
expect(browser).to_be_hidden()
|
|
33
29
|
page.goto(f"{live_server.url}{map.get_absolute_url()}?datalayersControl=false")
|
|
34
30
|
expect(control).to_be_hidden()
|
|
35
|
-
expect(
|
|
36
|
-
|
|
37
|
-
expect(control).to_be_hidden()
|
|
38
|
-
expect(box).to_be_hidden()
|
|
31
|
+
expect(browser).to_be_hidden()
|
|
32
|
+
# Retrocompat
|
|
39
33
|
page.goto(f"{live_server.url}{map.get_absolute_url()}?datalayersControl=expanded")
|
|
40
|
-
expect(control).
|
|
41
|
-
expect(
|
|
34
|
+
expect(control).to_be_visible()
|
|
35
|
+
expect(browser).to_be_visible()
|
|
42
36
|
|
|
43
37
|
|
|
44
38
|
def test_can_deactivate_wheel_from_query_string(map, live_server, page):
|
|
@@ -40,7 +40,8 @@ def test_javascript_have_been_loaded(
|
|
|
40
40
|
expect(page).to_have_url(re.compile(r".*#7/48\..+/13\..+"))
|
|
41
41
|
expect(page).to_have_url(re.compile(r".*/fr/"))
|
|
42
42
|
# Should be in French, so hashed locale file has been loaded correctly
|
|
43
|
-
button = page.
|
|
43
|
+
button = page.get_by_role("button", name="Voir les calques")
|
|
44
44
|
expect(button).to_be_visible()
|
|
45
|
-
|
|
45
|
+
button.click()
|
|
46
|
+
layers = page.locator(".umap-browser .datalayer")
|
|
46
47
|
expect(layers).to_have_count(1)
|
|
@@ -2,17 +2,13 @@ import json
|
|
|
2
2
|
import re
|
|
3
3
|
from pathlib import Path
|
|
4
4
|
|
|
5
|
-
from playwright.sync_api import expect
|
|
6
|
-
|
|
7
5
|
from umap.models import DataLayer
|
|
8
6
|
|
|
9
7
|
|
|
10
8
|
def test_table_editor(live_server, openmap, datalayer, page):
|
|
11
9
|
page.goto(f"{live_server.url}{openmap.get_absolute_url()}?edit")
|
|
12
10
|
page.get_by_role("link", name="Manage layers").click()
|
|
13
|
-
page.locator("
|
|
14
|
-
"Edit properties in a table"
|
|
15
|
-
).click()
|
|
11
|
+
page.locator(".panel").get_by_title("Edit properties in a table").click()
|
|
16
12
|
page.once("dialog", lambda dialog: dialog.accept(prompt_text="newprop"))
|
|
17
13
|
page.get_by_text("Add a new property").click()
|
|
18
14
|
page.locator('input[name="newprop"]').fill("newvalue")
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
from copy import deepcopy
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
from playwright.sync_api import expect
|
|
5
|
+
|
|
6
|
+
from ..base import DataLayerFactory
|
|
7
|
+
|
|
8
|
+
pytestmark = pytest.mark.django_db
|
|
9
|
+
|
|
10
|
+
DATALAYER_DATA = {
|
|
11
|
+
"type": "FeatureCollection",
|
|
12
|
+
"features": [
|
|
13
|
+
{
|
|
14
|
+
"type": "Feature",
|
|
15
|
+
"properties": {
|
|
16
|
+
"name": "test marker",
|
|
17
|
+
"description": "Some description",
|
|
18
|
+
},
|
|
19
|
+
"geometry": {
|
|
20
|
+
"type": "Point",
|
|
21
|
+
"coordinates": [14.6889, 48.5529],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@pytest.fixture
|
|
29
|
+
def bootstrap(map, live_server):
|
|
30
|
+
DataLayerFactory(map=map, data=DATALAYER_DATA)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def test_should_open_popup_on_click(live_server, map, page, bootstrap):
|
|
34
|
+
page.goto(f"{live_server.url}{map.get_absolute_url()}")
|
|
35
|
+
expect(page.locator(".umap-icon-active")).to_be_hidden()
|
|
36
|
+
page.locator(".leaflet-marker-icon").click()
|
|
37
|
+
expect(page.locator(".umap-icon-active")).to_be_visible()
|
|
38
|
+
expect(page.locator(".leaflet-popup-content-wrapper")).to_be_visible()
|
|
39
|
+
expect(page.get_by_role("heading", name="test marker")).to_be_visible()
|
|
40
|
+
expect(page.get_by_text("Some description")).to_be_visible()
|
|
41
|
+
# Close popup
|
|
42
|
+
page.locator("#map").click()
|
|
43
|
+
expect(page.locator(".umap-icon-active")).to_be_hidden()
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def test_should_handle_locale_var_in_description(live_server, map, page):
|
|
47
|
+
data = deepcopy(DATALAYER_DATA)
|
|
48
|
+
data["features"][0]["properties"]["description"] = (
|
|
49
|
+
"this is a link to [[https://domain.org/?locale={locale}|Wikipedia]]"
|
|
50
|
+
)
|
|
51
|
+
DataLayerFactory(map=map, data=data)
|
|
52
|
+
page.goto(f"{live_server.url}{map.get_absolute_url()}")
|
|
53
|
+
page.locator(".leaflet-marker-icon").click()
|
|
54
|
+
link = page.get_by_role("link", name="Wikipedia")
|
|
55
|
+
expect(link).to_be_visible()
|
|
56
|
+
expect(link).to_have_attribute("href", "https://domain.org/?locale=en")
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def test_should_display_tooltip_with_variable(live_server, map, page, bootstrap):
|
|
60
|
+
map.settings["properties"]["showLabel"] = True
|
|
61
|
+
map.settings["properties"]["labelKey"] = "Foo {name}"
|
|
62
|
+
map.save()
|
|
63
|
+
page.goto(f"{live_server.url}{map.get_absolute_url()}")
|
|
64
|
+
expect(page.get_by_text("Foo test marker")).to_be_visible()
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import re
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
from playwright.sync_api import expect
|
|
5
|
+
|
|
6
|
+
from ..base import DataLayerFactory
|
|
7
|
+
|
|
8
|
+
pytestmark = pytest.mark.django_db
|
|
9
|
+
|
|
10
|
+
DATALAYER_DATA = {
|
|
11
|
+
"type": "FeatureCollection",
|
|
12
|
+
"features": [
|
|
13
|
+
{
|
|
14
|
+
"type": "Feature",
|
|
15
|
+
"properties": {"name": "name poly", "description": "poly description"},
|
|
16
|
+
"id": "gyNzM",
|
|
17
|
+
"geometry": {
|
|
18
|
+
"type": "Polygon",
|
|
19
|
+
"coordinates": [
|
|
20
|
+
[
|
|
21
|
+
[11.25, 53.585984],
|
|
22
|
+
[10.151367, 52.975108],
|
|
23
|
+
[12.689209, 52.167194],
|
|
24
|
+
[14.084473, 53.199452],
|
|
25
|
+
[12.634277, 53.618579],
|
|
26
|
+
[11.25, 53.585984],
|
|
27
|
+
[11.25, 53.585984],
|
|
28
|
+
],
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@pytest.fixture
|
|
37
|
+
def bootstrap(map, live_server):
|
|
38
|
+
map.settings["properties"]["zoom"] = 6
|
|
39
|
+
map.settings["geometry"] = {
|
|
40
|
+
"type": "Point",
|
|
41
|
+
"coordinates": [8.429, 53.239],
|
|
42
|
+
}
|
|
43
|
+
map.save()
|
|
44
|
+
DataLayerFactory(map=map, data=DATALAYER_DATA)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def test_should_open_popup_on_click(live_server, map, page, bootstrap):
|
|
48
|
+
page.goto(f"{live_server.url}{map.get_absolute_url()}")
|
|
49
|
+
polygon = page.locator("path").first
|
|
50
|
+
expect(polygon).to_have_attribute("fill-opacity", "0.3")
|
|
51
|
+
polygon.click()
|
|
52
|
+
expect(page.locator(".leaflet-popup-content-wrapper")).to_be_visible()
|
|
53
|
+
expect(page.get_by_role("heading", name="name poly")).to_be_visible()
|
|
54
|
+
expect(page.get_by_text("poly description")).to_be_visible()
|
|
55
|
+
# It's not a round value
|
|
56
|
+
expect(polygon).to_have_attribute("fill-opacity", re.compile(r"0.5\d+"))
|
|
57
|
+
# Close popup
|
|
58
|
+
page.locator("#map").click()
|
|
59
|
+
expect(polygon).to_have_attribute("fill-opacity", "0.3")
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from playwright.sync_api import expect
|
|
3
|
+
|
|
4
|
+
from ..base import DataLayerFactory
|
|
5
|
+
|
|
6
|
+
pytestmark = pytest.mark.django_db
|
|
7
|
+
|
|
8
|
+
DATALAYER_DATA = {
|
|
9
|
+
"type": "FeatureCollection",
|
|
10
|
+
"features": [
|
|
11
|
+
{
|
|
12
|
+
"type": "Feature",
|
|
13
|
+
"properties": {"name": "name line", "description": "line description"},
|
|
14
|
+
"geometry": {
|
|
15
|
+
"type": "LineString",
|
|
16
|
+
"coordinates": [
|
|
17
|
+
# Flat line so PW will click on it
|
|
18
|
+
# (it compute the center of the element)
|
|
19
|
+
[11.25, 53.585984],
|
|
20
|
+
[10.151367, 52.975108],
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@pytest.fixture
|
|
29
|
+
def bootstrap(map, live_server):
|
|
30
|
+
map.settings["properties"]["zoom"] = 6
|
|
31
|
+
map.settings["geometry"] = {
|
|
32
|
+
"type": "Point",
|
|
33
|
+
"coordinates": [8.429, 53.239],
|
|
34
|
+
}
|
|
35
|
+
map.save()
|
|
36
|
+
DataLayerFactory(map=map, data=DATALAYER_DATA)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def test_should_open_popup_on_click(live_server, map, page, bootstrap):
|
|
40
|
+
page.goto(f"{live_server.url}{map.get_absolute_url()}")
|
|
41
|
+
line = page.locator("path").first
|
|
42
|
+
expect(line).to_have_attribute("stroke-opacity", "0.5")
|
|
43
|
+
line.click()
|
|
44
|
+
expect(page.locator(".leaflet-popup-content-wrapper")).to_be_visible()
|
|
45
|
+
expect(page.get_by_role("heading", name="name line")).to_be_visible()
|
|
46
|
+
expect(page.get_by_text("line description")).to_be_visible()
|
|
47
|
+
# It's not a round value
|
|
48
|
+
expect(line).to_have_attribute("stroke-opacity", "1")
|
|
49
|
+
# Close popup
|
|
50
|
+
page.locator("#map").click()
|
|
51
|
+
expect(line).to_have_attribute("stroke-opacity", "0.5")
|
umap/tests/test_map_views.py
CHANGED
|
@@ -847,3 +847,16 @@ def test_oembed_link(client, map, datalayer):
|
|
|
847
847
|
f'?url=http%3A%2F%2Ftestserver%2Fen%2Fmap%2Ftest-map_{map.id}&format=json"'
|
|
848
848
|
) in response.content.decode()
|
|
849
849
|
assert 'title="test map oEmbed URL" />' in response.content.decode()
|
|
850
|
+
|
|
851
|
+
|
|
852
|
+
def test_ogp_links(client, map, datalayer):
|
|
853
|
+
response = client.get(map.get_absolute_url())
|
|
854
|
+
assert response.status_code == 200
|
|
855
|
+
content = response.content.decode()
|
|
856
|
+
assert (
|
|
857
|
+
f'<meta property="og:url" content="http://umap.org{map.get_absolute_url()}" />'
|
|
858
|
+
in content
|
|
859
|
+
)
|
|
860
|
+
assert f'<meta property="og:title" content="{map.name}" />' in content
|
|
861
|
+
assert f'<meta property="og:description" content="{map.description}" />' in content
|
|
862
|
+
assert '<meta property="og:site_name" content="uMap" />' in content
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: umap-project
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0b0
|
|
4
4
|
Summary: Create maps with OpenStreetMap layers in a minute and embed them in your site.
|
|
5
5
|
Author-email: Yohan Boniface <yb@enix.org>
|
|
6
6
|
Maintainer-email: David Larlet <david@larlet.fr>
|
|
@@ -19,25 +19,25 @@ Requires-Python: >=3.10
|
|
|
19
19
|
Requires-Dist: django-agnocomplete==2.2.0
|
|
20
20
|
Requires-Dist: django-environ==0.11.2
|
|
21
21
|
Requires-Dist: django-probes==1.7.0
|
|
22
|
-
Requires-Dist: django==5.0.
|
|
23
|
-
Requires-Dist: pillow==10.
|
|
22
|
+
Requires-Dist: django==5.0.4
|
|
23
|
+
Requires-Dist: pillow==10.3.0
|
|
24
24
|
Requires-Dist: psycopg==3.1.18
|
|
25
25
|
Requires-Dist: rcssmin==1.1.2
|
|
26
26
|
Requires-Dist: requests==2.31.0
|
|
27
27
|
Requires-Dist: rjsmin==1.2.2
|
|
28
|
-
Requires-Dist: social-auth-app-django==5.4.
|
|
28
|
+
Requires-Dist: social-auth-app-django==5.4.1
|
|
29
29
|
Requires-Dist: social-auth-core==4.5.3
|
|
30
30
|
Provides-Extra: dev
|
|
31
31
|
Requires-Dist: djlint==1.34.1; extra == 'dev'
|
|
32
32
|
Requires-Dist: hatch==1.9.4; extra == 'dev'
|
|
33
33
|
Requires-Dist: isort==5.13.2; extra == 'dev'
|
|
34
|
-
Requires-Dist: mkdocs-material==9.5.
|
|
34
|
+
Requires-Dist: mkdocs-material==9.5.18; extra == 'dev'
|
|
35
35
|
Requires-Dist: mkdocs==1.5.3; extra == 'dev'
|
|
36
|
-
Requires-Dist: pymdown-extensions==10.
|
|
37
|
-
Requires-Dist: ruff==0.
|
|
36
|
+
Requires-Dist: pymdown-extensions==10.8; extra == 'dev'
|
|
37
|
+
Requires-Dist: ruff==0.4.1; extra == 'dev'
|
|
38
38
|
Requires-Dist: vermin==1.6.0; extra == 'dev'
|
|
39
39
|
Provides-Extra: docker
|
|
40
|
-
Requires-Dist: uwsgi==2.0.
|
|
40
|
+
Requires-Dist: uwsgi==2.0.25.1; extra == 'docker'
|
|
41
41
|
Provides-Extra: test
|
|
42
42
|
Requires-Dist: factory-boy==3.2.1; extra == 'test'
|
|
43
43
|
Requires-Dist: playwright>=1.39; extra == 'test'
|