umap-project 2.2.2__py3-none-any.whl → 2.3.1__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.

Files changed (156) hide show
  1. umap/__init__.py +1 -1
  2. umap/locale/pl/LC_MESSAGES/django.mo +0 -0
  3. umap/locale/pl/LC_MESSAGES/django.po +83 -78
  4. umap/locale/pt/LC_MESSAGES/django.mo +0 -0
  5. umap/locale/pt/LC_MESSAGES/django.po +129 -123
  6. umap/static/umap/base.css +85 -44
  7. umap/static/umap/css/icon.css +6 -0
  8. umap/static/umap/css/panel.css +9 -4
  9. umap/static/umap/img/16.svg +2 -2
  10. umap/static/umap/img/source/16.svg +3 -3
  11. umap/static/umap/js/modules/browser.js +58 -24
  12. umap/static/umap/js/modules/caption.js +118 -0
  13. umap/static/umap/js/modules/facets.js +14 -39
  14. umap/static/umap/js/modules/global.js +2 -0
  15. umap/static/umap/js/modules/orderable.js +1 -1
  16. umap/static/umap/js/modules/panel.js +13 -7
  17. umap/static/umap/js/modules/schema.js +4 -4
  18. umap/static/umap/js/modules/urls.js +1 -1
  19. umap/static/umap/js/modules/utils.js +9 -1
  20. umap/static/umap/js/umap.controls.js +40 -110
  21. umap/static/umap/js/umap.core.js +19 -20
  22. umap/static/umap/js/umap.features.js +8 -2
  23. umap/static/umap/js/umap.forms.js +95 -34
  24. umap/static/umap/js/umap.js +47 -54
  25. umap/static/umap/js/umap.layer.js +5 -8
  26. umap/static/umap/js/umap.popup.js +1 -0
  27. umap/static/umap/locale/am_ET.js +11 -12
  28. umap/static/umap/locale/am_ET.json +11 -12
  29. umap/static/umap/locale/ar.js +11 -12
  30. umap/static/umap/locale/ar.json +11 -12
  31. umap/static/umap/locale/ast.js +11 -12
  32. umap/static/umap/locale/ast.json +11 -12
  33. umap/static/umap/locale/bg.js +11 -12
  34. umap/static/umap/locale/bg.json +11 -12
  35. umap/static/umap/locale/br.js +11 -12
  36. umap/static/umap/locale/br.json +11 -12
  37. umap/static/umap/locale/ca.js +11 -12
  38. umap/static/umap/locale/ca.json +11 -12
  39. umap/static/umap/locale/cs_CZ.js +11 -12
  40. umap/static/umap/locale/cs_CZ.json +11 -12
  41. umap/static/umap/locale/da.js +11 -12
  42. umap/static/umap/locale/da.json +11 -12
  43. umap/static/umap/locale/de.js +11 -12
  44. umap/static/umap/locale/de.json +11 -12
  45. umap/static/umap/locale/el.js +11 -12
  46. umap/static/umap/locale/el.json +11 -12
  47. umap/static/umap/locale/en.js +11 -12
  48. umap/static/umap/locale/en.json +11 -12
  49. umap/static/umap/locale/en_US.json +11 -12
  50. umap/static/umap/locale/es.js +11 -12
  51. umap/static/umap/locale/es.json +11 -12
  52. umap/static/umap/locale/et.js +11 -12
  53. umap/static/umap/locale/et.json +11 -12
  54. umap/static/umap/locale/eu.js +27 -16
  55. umap/static/umap/locale/eu.json +27 -16
  56. umap/static/umap/locale/fa_IR.js +11 -12
  57. umap/static/umap/locale/fa_IR.json +11 -12
  58. umap/static/umap/locale/fi.js +11 -12
  59. umap/static/umap/locale/fi.json +11 -12
  60. umap/static/umap/locale/fr.js +11 -12
  61. umap/static/umap/locale/fr.json +11 -12
  62. umap/static/umap/locale/gl.js +11 -12
  63. umap/static/umap/locale/gl.json +11 -12
  64. umap/static/umap/locale/he.js +11 -12
  65. umap/static/umap/locale/he.json +11 -12
  66. umap/static/umap/locale/hr.js +11 -12
  67. umap/static/umap/locale/hr.json +11 -12
  68. umap/static/umap/locale/hu.js +29 -30
  69. umap/static/umap/locale/hu.json +29 -30
  70. umap/static/umap/locale/id.js +11 -12
  71. umap/static/umap/locale/id.json +11 -12
  72. umap/static/umap/locale/is.js +11 -12
  73. umap/static/umap/locale/is.json +11 -12
  74. umap/static/umap/locale/it.js +11 -12
  75. umap/static/umap/locale/it.json +11 -12
  76. umap/static/umap/locale/ja.js +11 -12
  77. umap/static/umap/locale/ja.json +11 -12
  78. umap/static/umap/locale/ko.js +11 -12
  79. umap/static/umap/locale/ko.json +11 -12
  80. umap/static/umap/locale/lt.js +11 -12
  81. umap/static/umap/locale/lt.json +11 -12
  82. umap/static/umap/locale/ms.js +20 -21
  83. umap/static/umap/locale/ms.json +20 -21
  84. umap/static/umap/locale/nl.js +11 -12
  85. umap/static/umap/locale/nl.json +11 -12
  86. umap/static/umap/locale/no.js +11 -12
  87. umap/static/umap/locale/no.json +11 -12
  88. umap/static/umap/locale/pl.js +11 -12
  89. umap/static/umap/locale/pl.json +11 -12
  90. umap/static/umap/locale/pl_PL.json +11 -12
  91. umap/static/umap/locale/pt.js +11 -12
  92. umap/static/umap/locale/pt.json +11 -12
  93. umap/static/umap/locale/pt_BR.js +11 -12
  94. umap/static/umap/locale/pt_BR.json +11 -12
  95. umap/static/umap/locale/pt_PT.js +11 -12
  96. umap/static/umap/locale/pt_PT.json +11 -12
  97. umap/static/umap/locale/ro.js +11 -12
  98. umap/static/umap/locale/ro.json +11 -12
  99. umap/static/umap/locale/ru.js +11 -12
  100. umap/static/umap/locale/ru.json +11 -12
  101. umap/static/umap/locale/si.js +240 -227
  102. umap/static/umap/locale/si.json +240 -227
  103. umap/static/umap/locale/sk_SK.js +11 -12
  104. umap/static/umap/locale/sk_SK.json +11 -12
  105. umap/static/umap/locale/sl.js +11 -12
  106. umap/static/umap/locale/sl.json +11 -12
  107. umap/static/umap/locale/sr.js +11 -12
  108. umap/static/umap/locale/sr.json +11 -12
  109. umap/static/umap/locale/sv.js +11 -12
  110. umap/static/umap/locale/sv.json +11 -12
  111. umap/static/umap/locale/th_TH.js +11 -12
  112. umap/static/umap/locale/th_TH.json +11 -12
  113. umap/static/umap/locale/tr.js +11 -12
  114. umap/static/umap/locale/tr.json +11 -12
  115. umap/static/umap/locale/uk_UA.js +11 -12
  116. umap/static/umap/locale/uk_UA.json +11 -12
  117. umap/static/umap/locale/vi.js +11 -12
  118. umap/static/umap/locale/vi.json +11 -12
  119. umap/static/umap/locale/vi_VN.json +11 -12
  120. umap/static/umap/locale/zh.js +11 -12
  121. umap/static/umap/locale/zh.json +11 -12
  122. umap/static/umap/locale/zh_CN.json +11 -12
  123. umap/static/umap/locale/zh_TW.Big5.json +11 -12
  124. umap/static/umap/locale/zh_TW.js +11 -12
  125. umap/static/umap/locale/zh_TW.json +11 -12
  126. umap/static/umap/map.css +17 -2
  127. umap/static/umap/unittests/utils.js +7 -0
  128. umap/static/umap/vars.css +10 -0
  129. umap/static/umap/vendors/dompurify/purify.es.js +96 -12
  130. umap/static/umap/vendors/dompurify/purify.es.mjs.map +1 -1
  131. umap/tests/base.py +1 -0
  132. umap/tests/integration/conftest.py +5 -4
  133. umap/tests/integration/test_browser.py +11 -2
  134. umap/tests/integration/test_caption.py +27 -0
  135. umap/tests/integration/test_choropleth.py +1 -1
  136. umap/tests/integration/test_draw_polygon.py +6 -0
  137. umap/tests/integration/test_draw_polyline.py +6 -0
  138. umap/tests/integration/test_edit_datalayer.py +34 -5
  139. umap/tests/integration/test_edit_map.py +4 -4
  140. umap/tests/integration/test_edit_marker.py +6 -6
  141. umap/tests/integration/test_edit_polygon.py +6 -6
  142. umap/tests/integration/test_facets_browser.py +85 -13
  143. umap/tests/integration/test_map.py +0 -15
  144. umap/tests/integration/test_view_marker.py +17 -0
  145. {umap_project-2.2.2.dist-info → umap_project-2.3.1.dist-info}/METADATA +9 -8
  146. {umap_project-2.2.2.dist-info → umap_project-2.3.1.dist-info}/RECORD +149 -154
  147. {umap_project-2.2.2.dist-info → umap_project-2.3.1.dist-info}/WHEEL +1 -1
  148. umap/.DS_Store +0 -0
  149. umap/static/.DS_Store +0 -0
  150. umap/static/umap/.DS_Store +0 -0
  151. umap/static/umap/favicons/.DS_Store +0 -0
  152. umap/static/umap/fonts/.DS_Store +0 -0
  153. umap/tests/.DS_Store +0 -0
  154. umap/tests/integration/.DS_Store +0 -0
  155. {umap_project-2.2.2.dist-info → umap_project-2.3.1.dist-info}/entry_points.txt +0 -0
  156. {umap_project-2.2.2.dist-info → umap_project-2.3.1.dist-info}/licenses/LICENSE +0 -0
umap/tests/base.py CHANGED
@@ -125,6 +125,7 @@ class DataLayerFactory(factory.django.DjangoModelFactory):
125
125
  **kwargs["settings"],
126
126
  }
127
127
  data.setdefault("_umap_options", {})
128
+ kwargs["settings"]["name"] = kwargs["name"]
128
129
  data["_umap_options"]["name"] = kwargs["name"]
129
130
  kwargs["geojson"] = ContentFile(json.dumps(data), "foo.json")
130
131
  return kwargs
@@ -1,14 +1,15 @@
1
1
  import os
2
2
 
3
3
  import pytest
4
+ from playwright.sync_api import expect
4
5
 
5
6
 
6
7
  @pytest.fixture(autouse=True)
7
8
  def set_timeout(context):
8
- context.set_default_timeout(int(os.environ.get("PLAYWRIGHT_TIMEOUT", 7500)))
9
- context.set_default_navigation_timeout(
10
- int(os.environ.get("PLAYWRIGHT_TIMEOUT", 7500))
11
- )
9
+ timeout = int(os.environ.get("PLAYWRIGHT_TIMEOUT", 7500))
10
+ context.set_default_timeout(timeout)
11
+ context.set_default_navigation_timeout(timeout)
12
+ expect.set_options(timeout=timeout)
12
13
 
13
14
 
14
15
  @pytest.fixture(autouse=True)
@@ -1,3 +1,4 @@
1
+ import re
1
2
  from copy import deepcopy
2
3
  from time import sleep
3
4
 
@@ -63,8 +64,9 @@ def bootstrap(map, live_server):
63
64
 
64
65
  def test_data_browser_should_be_open(live_server, page, bootstrap, map):
65
66
  page.goto(f"{live_server.url}{map.get_absolute_url()}")
66
- el = page.locator(".umap-browser")
67
- expect(el).to_be_visible()
67
+ panel = page.locator(".panel.left.on")
68
+ expect(panel).to_have_class(re.compile(".*expanded.*"))
69
+ expect(panel.locator(".umap-browser")).to_be_visible()
68
70
  expect(page.get_by_text("one point in france")).to_be_visible()
69
71
  expect(page.get_by_text("one line in new zeland")).to_be_visible()
70
72
  expect(page.get_by_text("one polygon in greenland")).to_be_visible()
@@ -77,6 +79,7 @@ def test_data_browser_should_be_filterable(live_server, page, bootstrap, map):
77
79
  paths = page.locator(".leaflet-overlay-pane path")
78
80
  expect(markers).to_have_count(1)
79
81
  expect(paths).to_have_count(2)
82
+ page.locator(".filters summary").click()
80
83
  filter_ = page.locator("input[name='filter']")
81
84
  expect(filter_).to_be_visible()
82
85
  filter_.type("poly")
@@ -103,6 +106,7 @@ def test_data_browser_should_be_filterable(live_server, page, bootstrap, map):
103
106
  def test_data_browser_can_show_only_visible_features(live_server, page, bootstrap, map):
104
107
  # Zoom on France
105
108
  page.goto(f"{live_server.url}{map.get_absolute_url()}#6/51.000/2.000")
109
+ page.locator(".filters summary").click()
106
110
  el = page.get_by_text("Current map view")
107
111
  expect(el).to_be_visible()
108
112
  el.click()
@@ -114,6 +118,7 @@ def test_data_browser_can_show_only_visible_features(live_server, page, bootstra
114
118
  def test_data_browser_can_mix_filter_and_bbox(live_server, page, bootstrap, map):
115
119
  # Zoom on north west
116
120
  page.goto(f"{live_server.url}{map.get_absolute_url()}#4/61.98/-2.68")
121
+ page.locator(".filters summary").click()
117
122
  el = page.get_by_text("Current map view")
118
123
  expect(el).to_be_visible()
119
124
  el.click()
@@ -131,6 +136,7 @@ def test_data_browser_can_mix_filter_and_bbox(live_server, page, bootstrap, map)
131
136
  def test_data_browser_bbox_limit_should_be_dynamic(live_server, page, bootstrap, map):
132
137
  # Zoom on Europe
133
138
  page.goto(f"{live_server.url}{map.get_absolute_url()}#6/51.000/2.000")
139
+ page.locator(".filters summary").click()
134
140
  el = page.get_by_text("Current map view")
135
141
  expect(el).to_be_visible()
136
142
  el.click()
@@ -156,6 +162,7 @@ def test_data_browser_bbox_filter_should_be_persistent(
156
162
  ):
157
163
  # Zoom on Europe
158
164
  page.goto(f"{live_server.url}{map.get_absolute_url()}#6/51.000/2.000")
165
+ page.locator(".filters summary").click()
159
166
  el = page.get_by_text("Current map view")
160
167
  expect(el).to_be_visible()
161
168
  el.click()
@@ -181,6 +188,7 @@ def test_data_browser_bbox_filtered_is_clickable(live_server, page, bootstrap, m
181
188
  popup = page.locator(".leaflet-popup")
182
189
  # Zoom on Europe
183
190
  page.goto(f"{live_server.url}{map.get_absolute_url()}#6/51.000/2.000")
191
+ page.locator(".filters summary").click()
184
192
  el = page.get_by_text("Current map view")
185
193
  expect(el).to_be_visible()
186
194
  el.click()
@@ -202,6 +210,7 @@ def test_data_browser_with_variable_in_name(live_server, page, bootstrap, map):
202
210
  expect(page.get_by_text("one point in france (point)")).to_be_visible()
203
211
  expect(page.get_by_text("one line in new zeland (line)")).to_be_visible()
204
212
  expect(page.get_by_text("one polygon in greenland (polygon)")).to_be_visible()
213
+ page.locator(".filters summary").click()
205
214
  filter_ = page.locator("input[name='filter']")
206
215
  expect(filter_).to_be_visible()
207
216
  filter_.type("foobar") # Hide all
@@ -0,0 +1,27 @@
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
+
11
+ def test_caption(live_server, page, map):
12
+ map.settings["properties"]["onLoadPanel"] = "caption"
13
+ map.save()
14
+ basic = DataLayerFactory(map=map, name="Basic layer")
15
+ non_loaded = DataLayerFactory(
16
+ map=map, name="Non loaded", settings={"displayOnLoad": False}
17
+ )
18
+ hidden = DataLayerFactory(map=map, name="Hidden", settings={"inCaption": False})
19
+ page.goto(f"{live_server.url}{map.get_absolute_url()}")
20
+ panel = page.locator(".panel.left.on")
21
+ expect(panel).to_have_class(re.compile(".*condensed.*"))
22
+ expect(panel.locator(".umap-caption")).to_be_visible()
23
+ expect(panel.locator(".datalayer-legend").get_by_text(basic.name)).to_be_visible()
24
+ expect(
25
+ panel.locator(".datalayer-legend .off").get_by_text(non_loaded.name)
26
+ ).to_be_visible()
27
+ expect(panel.locator(".datalayer-legend").get_by_text(hidden.name)).to_be_hidden()
@@ -50,7 +50,7 @@ def test_basic_choropleth_map_with_custom_brewer(openmap, live_server, page):
50
50
  page.get_by_role("button", name="Edit").click()
51
51
  page.get_by_role("link", name="Manage layers").click()
52
52
  page.locator(".panel").get_by_title("Edit", exact=True).click()
53
- page.get_by_role("heading", name="Choropleth: settings").click()
53
+ page.get_by_text("Choropleth: settings").click()
54
54
  page.locator('select[name="brewer"]').select_option("Greens")
55
55
 
56
56
  # Hauts-de-France
@@ -83,6 +83,8 @@ def test_clicking_esc_should_finish_polygon(page, live_server, tilelayer):
83
83
  page.keyboard.press("Escape")
84
84
  expect(lines).to_have_count(1)
85
85
  expect(guide).to_have_count(0)
86
+ # Should have opened edit form panel
87
+ expect(page.locator(".panel").get_by_text("Feature properties")).to_be_visible()
86
88
 
87
89
 
88
90
  def test_clicking_esc_should_delete_polygon_if_empty(page, live_server, tilelayer):
@@ -106,6 +108,8 @@ def test_clicking_esc_should_delete_polygon_if_empty(page, live_server, tilelaye
106
108
  page.keyboard.press("Escape")
107
109
  expect(lines).to_have_count(0)
108
110
  expect(guide).to_have_count(0)
111
+ # Should not have opened edit form panel
112
+ expect(page.locator(".panel").get_by_text("Feature properties")).to_be_hidden()
109
113
 
110
114
 
111
115
  def test_clicking_esc_should_delete_polygon_if_invalid(page, live_server, tilelayer):
@@ -137,6 +141,8 @@ def test_clicking_esc_should_delete_polygon_if_invalid(page, live_server, tilela
137
141
  page.keyboard.press("Escape")
138
142
  expect(lines).to_have_count(0)
139
143
  expect(guide).to_have_count(0)
144
+ # Should not have opened edit form panel
145
+ expect(page.locator(".panel").get_by_text("Feature properties")).to_be_hidden()
140
146
 
141
147
 
142
148
  def test_can_draw_multi(live_server, page, tilelayer):
@@ -83,6 +83,8 @@ def test_clicking_esc_should_finish_line(page, live_server, tilelayer):
83
83
  page.keyboard.press("Escape")
84
84
  expect(lines).to_have_count(1)
85
85
  expect(guide).to_have_count(0)
86
+ # Should have opened edit form panel
87
+ expect(page.locator(".panel").get_by_text("Feature properties")).to_be_visible()
86
88
 
87
89
 
88
90
  def test_clicking_esc_should_delete_line_if_empty(page, live_server, tilelayer):
@@ -110,6 +112,8 @@ def test_clicking_esc_should_delete_line_if_empty(page, live_server, tilelayer):
110
112
  page.keyboard.press("Escape")
111
113
  expect(lines).to_have_count(0)
112
114
  expect(guide).to_have_count(0)
115
+ # Should not have opened edit form panel
116
+ expect(page.locator(".panel").get_by_text("Feature properties")).to_be_hidden()
113
117
 
114
118
 
115
119
  def test_clicking_esc_should_delete_line_if_invalid(page, live_server, tilelayer):
@@ -135,6 +139,8 @@ def test_clicking_esc_should_delete_line_if_invalid(page, live_server, tilelayer
135
139
  page.keyboard.press("Escape")
136
140
  expect(lines).to_have_count(0)
137
141
  expect(guide).to_have_count(0)
142
+ # Should not have opened edit form panel
143
+ expect(page.locator(".panel").get_by_text("Feature properties")).to_be_hidden()
138
144
 
139
145
 
140
146
  def test_can_draw_multi(live_server, page, tilelayer):
@@ -80,7 +80,7 @@ def test_can_clone_datalayer(live_server, openmap, login, datalayer, page):
80
80
  expect(markers).to_have_count(1)
81
81
  page.get_by_role("link", name="Manage layers").click()
82
82
  page.locator(".panel.right").get_by_title("Edit", exact=True).click()
83
- page.get_by_role("heading", name="Advanced actions").click()
83
+ page.get_by_text("Advanced actions").click()
84
84
  page.get_by_role("button", name="Clone").click()
85
85
  expect(layers).to_have_count(2)
86
86
  expect(markers).to_have_count(2)
@@ -104,7 +104,7 @@ def test_can_change_icon_class(live_server, openmap, page):
104
104
  page.get_by_role("link", name="Manage layers").click()
105
105
  expect(page.locator(".umap-circle-icon")).to_be_hidden()
106
106
  page.locator(".panel.right").get_by_title("Edit", exact=True).click()
107
- page.get_by_role("heading", name="Shape properties").click()
107
+ page.get_by_text("Shape properties").click()
108
108
  page.locator(".umap-field-iconClass a.define").click()
109
109
  page.get_by_text("Circle").click()
110
110
  expect(page.locator(".umap-circle-icon")).to_be_visible()
@@ -165,14 +165,14 @@ def test_can_restore_version(live_server, openmap, page, datalayer):
165
165
  marker = page.locator(".leaflet-marker-icon")
166
166
  expect(marker).to_have_class(re.compile(".*umap-ball-icon.*"))
167
167
  marker.click(modifiers=["Shift"])
168
- page.get_by_role("heading", name="Shape properties").click()
168
+ page.get_by_text("Shape properties").click()
169
169
  page.locator("#umap-feature-shape-properties").get_by_text("Default").click()
170
170
  with page.expect_response(re.compile(".*/datalayer/update/.*")):
171
171
  page.get_by_role("button", name="Save").click()
172
172
  expect(marker).to_have_class(re.compile(".*umap-div-icon.*"))
173
173
  page.get_by_role("link", name="Manage layers").click()
174
174
  page.locator(".panel.right").get_by_title("Edit", exact=True).click()
175
- page.get_by_role("heading", name="Versions").click()
175
+ page.get_by_text("Versions").click()
176
176
  page.once("dialog", lambda dialog: dialog.accept())
177
177
  page.get_by_role("button", name="Restore this version").last.click()
178
178
  expect(marker).to_have_class(re.compile(".*umap-ball-icon.*"))
@@ -182,4 +182,33 @@ def test_can_edit_layer_on_ctrl_shift_click(live_server, openmap, page, datalaye
182
182
  modifier = "Meta" if platform.system() == "Darwin" else "Control"
183
183
  page.goto(f"{live_server.url}{openmap.get_absolute_url()}?edit")
184
184
  page.locator(".leaflet-marker-icon").click(modifiers=[modifier, "Shift"])
185
- expect(page.get_by_role("heading", name="Layer properties")).to_be_visible()
185
+ expect(page.get_by_text("Layer properties")).to_be_visible()
186
+
187
+
188
+ def test_deleting_datalayer_should_remove_from_browser_and_layers_list(
189
+ live_server, openmap, datalayer, page
190
+ ):
191
+ page.goto(f"{live_server.url}{openmap.get_absolute_url()}?edit")
192
+ panel = page.locator(".panel.left")
193
+ edit_panel = page.locator(".panel.right")
194
+ page.get_by_title("See layers").click()
195
+ page.get_by_role("link", name="Manage layers").click()
196
+ expect(panel.get_by_text("test datalayer")).to_be_visible()
197
+ expect(edit_panel.get_by_text("test datalayer")).to_be_visible()
198
+ page.once("dialog", lambda dialog: dialog.accept())
199
+ page.locator(".panel.right").get_by_title("Delete layer").click()
200
+ expect(panel.get_by_text("test datalayer")).to_be_hidden()
201
+ expect(edit_panel.get_by_text("test datalayer")).to_be_hidden()
202
+
203
+
204
+ def test_deleting_datalayer_should_remove_from_caption(
205
+ live_server, openmap, datalayer, page
206
+ ):
207
+ page.goto(f"{live_server.url}{openmap.get_absolute_url()}?edit")
208
+ panel = page.locator(".panel.left")
209
+ page.get_by_role("button", name="About").click()
210
+ page.get_by_role("link", name="Manage layers").click()
211
+ expect(panel.get_by_text("test datalayer")).to_be_visible()
212
+ page.once("dialog", lambda dialog: dialog.accept())
213
+ page.locator(".panel.right").get_by_title("Delete layer").click()
214
+ expect(panel.get_by_text("test datalayer")).to_be_hidden()
@@ -58,7 +58,7 @@ def test_zoomcontrol_impacts_ui(live_server, page, tilelayer):
58
58
  expect(zoom_out).to_be_visible()
59
59
 
60
60
  # Hide them
61
- page.get_by_role("heading", name="User interface options").click()
61
+ page.get_by_text("User interface options").click()
62
62
  hide_zoom_controls = (
63
63
  page.locator("div")
64
64
  .filter(has_text=re.compile(r"^Display the zoom control"))
@@ -90,7 +90,7 @@ def test_map_color_impacts_data(live_server, page, tilelayer):
90
90
  expect(marker_pane_p1).to_have_count(1)
91
91
 
92
92
  # Change the default color
93
- page.get_by_role("heading", name="Shape properties").click()
93
+ page.get_by_text("Shape properties").click()
94
94
  page.locator("#umap-feature-shape-properties").get_by_text("define").first.click()
95
95
  page.get_by_title("Lime", exact=True).click()
96
96
 
@@ -108,7 +108,7 @@ def test_limitbounds_impacts_ui(live_server, page, tilelayer):
108
108
  expect(gear_icon).to_be_visible()
109
109
  gear_icon.click()
110
110
 
111
- page.get_by_role("heading", name="Limit bounds").click()
111
+ page.get_by_text("Limit bounds").click()
112
112
  default_zoom_url = f"{live_server.url}/en/map/new/#5/51.110/7.053"
113
113
  page.goto(default_zoom_url)
114
114
  page.get_by_role("button", name="Use current bounds").click()
@@ -183,7 +183,7 @@ def test_sortkey_impacts_datalayerindex(map, live_server, page):
183
183
  # Change the default sortkey to be "key"
184
184
  page.get_by_role("button", name="Edit").click()
185
185
  page.get_by_role("link", name="Map advanced properties").click()
186
- page.get_by_role("heading", name="Default properties").click()
186
+ page.get_by_text("Default properties").click()
187
187
 
188
188
  # Click "define"
189
189
  page.locator(".panel .umap-field-sortKey .define").click()
@@ -36,7 +36,7 @@ def test_can_edit_on_shift_click(live_server, openmap, page, datalayer):
36
36
  modifier = "Meta" if platform.system() == "Darwin" else "Control"
37
37
  page.goto(f"{live_server.url}{openmap.get_absolute_url()}?edit")
38
38
  page.locator(".leaflet-marker-icon").click(modifiers=[modifier, "Shift"])
39
- expect(page.get_by_role("heading", name="Layer properties")).to_be_visible()
39
+ expect(page.get_by_text("Layer properties")).to_be_visible()
40
40
 
41
41
 
42
42
  def test_marker_style_should_have_precedence(live_server, openmap, page, bootstrap):
@@ -45,7 +45,7 @@ def test_marker_style_should_have_precedence(live_server, openmap, page, bootstr
45
45
  # Change colour at layer level
46
46
  page.get_by_role("link", name="Manage layers").click()
47
47
  page.locator(".panel").get_by_title("Edit", exact=True).click()
48
- page.get_by_role("heading", name="Shape properties").click()
48
+ page.get_by_text("Shape properties").click()
49
49
  page.locator(".umap-field-color .define").click()
50
50
  expect(page.locator(".leaflet-marker-icon .icon_container")).to_have_css(
51
51
  "background-color", "rgb(0, 0, 139)"
@@ -57,7 +57,7 @@ def test_marker_style_should_have_precedence(live_server, openmap, page, bootstr
57
57
 
58
58
  # Now change at marker level, it should take precedence
59
59
  page.locator(".leaflet-marker-icon").click(modifiers=["Shift"])
60
- page.get_by_role("heading", name="Shape properties").click()
60
+ page.get_by_text("Shape properties").click()
61
61
  page.locator("#umap-feature-shape-properties").get_by_text("define").first.click()
62
62
  page.get_by_title("GoldenRod", exact=True).click()
63
63
  expect(page.locator(".leaflet-marker-icon .icon_container")).to_have_css(
@@ -67,7 +67,7 @@ def test_marker_style_should_have_precedence(live_server, openmap, page, bootstr
67
67
  # Now change again at layer level again, it should not change the marker color
68
68
  page.get_by_role("link", name="Manage layers").click()
69
69
  page.locator(".panel").get_by_title("Edit", exact=True).click()
70
- page.get_by_role("heading", name="Shape properties").click()
70
+ page.get_by_text("Shape properties").click()
71
71
  page.locator(".umap-field-color input").click()
72
72
  page.get_by_title("DarkViolet").first.click()
73
73
  expect(page.locator(".leaflet-marker-icon .icon_container")).to_have_css(
@@ -87,12 +87,12 @@ def test_should_update_open_popup_on_edit(live_server, openmap, page, bootstrap)
87
87
  expect(page.locator(".umap-icon-active")).to_be_hidden()
88
88
  page.locator(".leaflet-marker-icon").click()
89
89
  expect(page.locator(".leaflet-popup-content-wrapper")).to_be_visible()
90
- expect(page.get_by_role("heading", name="test marker")).to_be_visible()
90
+ expect(page.get_by_text("test marker")).to_be_visible()
91
91
  expect(page.get_by_text("Some description")).to_be_visible()
92
92
  page.get_by_role("button", name="Edit").click()
93
93
  page.locator(".leaflet-marker-icon").click(modifiers=["Shift"])
94
94
  page.locator('input[name="name"]').fill("test marker edited")
95
- expect(page.get_by_role("heading", name="test marker edited")).to_be_visible()
95
+ expect(page.get_by_text("test marker edited")).to_be_visible()
96
96
 
97
97
 
98
98
  def test_should_follow_datalayer_style_when_changing_datalayer(
@@ -50,7 +50,7 @@ def test_can_edit_on_shift_click(live_server, openmap, page, datalayer):
50
50
  modifier = "Meta" if platform.system() == "Darwin" else "Control"
51
51
  page.goto(f"{live_server.url}{openmap.get_absolute_url()}?edit")
52
52
  page.locator(".leaflet-marker-icon").click(modifiers=[modifier, "Shift"])
53
- expect(page.get_by_role("heading", name="Layer properties")).to_be_visible()
53
+ expect(page.get_by_text("Layer properties")).to_be_visible()
54
54
 
55
55
 
56
56
  def test_marker_style_should_have_precedence(live_server, openmap, page, bootstrap):
@@ -59,7 +59,7 @@ def test_marker_style_should_have_precedence(live_server, openmap, page, bootstr
59
59
  # Change colour at layer level
60
60
  page.get_by_role("link", name="Manage layers").click()
61
61
  page.locator(".panel").get_by_title("Edit", exact=True).click()
62
- page.get_by_role("heading", name="Shape properties").click()
62
+ page.get_by_text("Shape properties").click()
63
63
  page.locator(".umap-field-color .define").click()
64
64
  expect(page.locator(".leaflet-overlay-pane path[fill='DarkBlue']")).to_have_count(1)
65
65
  page.get_by_title("DarkRed").first.click()
@@ -67,7 +67,7 @@ def test_marker_style_should_have_precedence(live_server, openmap, page, bootstr
67
67
 
68
68
  # Now change at polygon level, it should take precedence
69
69
  page.locator("path").click(modifiers=["Shift"])
70
- page.get_by_role("heading", name="Shape properties").click()
70
+ page.get_by_text("Shape properties").click()
71
71
  page.locator("#umap-feature-shape-properties").get_by_text("define").first.click()
72
72
  page.get_by_title("GoldenRod", exact=True).first.click()
73
73
  expect(page.locator(".leaflet-overlay-pane path[fill='GoldenRod']")).to_have_count(
@@ -77,7 +77,7 @@ def test_marker_style_should_have_precedence(live_server, openmap, page, bootstr
77
77
  # Now change again at layer level again, it should not change the marker color
78
78
  page.get_by_role("link", name="Manage layers").click()
79
79
  page.locator(".panel").get_by_title("Edit", exact=True).click()
80
- page.get_by_role("heading", name="Shape properties").click()
80
+ page.get_by_text("Shape properties").click()
81
81
  page.locator(".umap-field-color input").click()
82
82
  page.get_by_title("DarkViolet").first.click()
83
83
  expect(page.locator(".leaflet-overlay-pane path[fill='GoldenRod']")).to_have_count(
@@ -99,7 +99,7 @@ def test_can_remove_stroke(live_server, openmap, page, bootstrap):
99
99
  )
100
100
  page.locator("path").click()
101
101
  page.get_by_role("link", name="Toggle edit mode").click()
102
- page.get_by_role("heading", name="Shape properties").click()
102
+ page.get_by_text("Shape properties").click()
103
103
  page.locator(".umap-field-stroke .define").first.click()
104
104
  page.locator(".umap-field-stroke label").first.click()
105
105
  expect(page.locator(".leaflet-overlay-pane path[stroke='DarkBlue']")).to_have_count(
@@ -111,7 +111,7 @@ def test_can_remove_stroke(live_server, openmap, page, bootstrap):
111
111
  def test_should_reset_style_on_cancel(live_server, openmap, page, bootstrap):
112
112
  page.goto(f"{live_server.url}{openmap.get_absolute_url()}?edit")
113
113
  page.locator("path").click(modifiers=["Shift"])
114
- page.get_by_role("heading", name="Shape properties").click()
114
+ page.get_by_text("Shape properties").click()
115
115
  page.locator("#umap-feature-shape-properties").get_by_text("define").first.click()
116
116
  page.get_by_title("GoldenRod", exact=True).first.click()
117
117
  expect(page.locator(".leaflet-overlay-pane path[fill='GoldenRod']")).to_have_count(
@@ -1,4 +1,5 @@
1
1
  import copy
2
+ import re
2
3
 
3
4
  import pytest
4
5
  from playwright.sync_api import expect
@@ -93,7 +94,7 @@ DATALAYER_DATA3 = {
93
94
 
94
95
 
95
96
  def test_simple_facet_search(live_server, page, map):
96
- map.settings["properties"]["onLoadPanel"] = "facet"
97
+ map.settings["properties"]["onLoadPanel"] = "datafilters"
97
98
  map.settings["properties"]["facetKey"] = "mytype|My type,mynumber|My Number|number"
98
99
  map.settings["properties"]["showLabel"] = True
99
100
  map.save()
@@ -101,7 +102,9 @@ def test_simple_facet_search(live_server, page, map):
101
102
  DataLayerFactory(map=map, data=DATALAYER_DATA2)
102
103
  DataLayerFactory(map=map, data=DATALAYER_DATA3)
103
104
  page.goto(f"{live_server.url}{map.get_absolute_url()}#6/48.948/1.670")
104
- panel = page.locator(".umap-facet-search")
105
+ panel = page.locator(".panel.left.on")
106
+ expect(panel).to_have_class(re.compile(".*expanded.*"))
107
+ expect(panel.locator(".umap-browser")).to_be_visible()
105
108
  # From a non browsable datalayer, should not be impacted
106
109
  paths = page.locator(".leaflet-overlay-pane path")
107
110
  expect(paths).to_be_visible()
@@ -117,17 +120,28 @@ def test_simple_facet_search(live_server, page, map):
117
120
  markers = page.locator(".leaflet-marker-icon")
118
121
  expect(markers).to_have_count(4)
119
122
  # Tooltips
120
- expect(page.get_by_text("Point 1")).to_be_visible()
121
- expect(page.get_by_text("Point 2")).to_be_visible()
122
- expect(page.get_by_text("Point 3")).to_be_visible()
123
- expect(page.get_by_text("Point 4")).to_be_visible()
123
+ expect(page.get_by_role("tooltip", name="Point 1")).to_be_visible()
124
+ expect(page.get_by_role("tooltip", name="Point 2")).to_be_visible()
125
+ expect(page.get_by_role("tooltip", name="Point 3")).to_be_visible()
126
+ expect(page.get_by_role("tooltip", name="Point 4")).to_be_visible()
127
+
128
+ # Datalist
129
+ expect(panel.get_by_text("Point 1")).to_be_visible()
130
+ expect(panel.get_by_text("Point 2")).to_be_visible()
131
+ expect(panel.get_by_text("Point 3")).to_be_visible()
132
+ expect(panel.get_by_text("Point 4")).to_be_visible()
133
+
124
134
  # Now let's filter
125
135
  odd.click()
126
136
  expect(markers).to_have_count(2)
127
- expect(page.get_by_text("Point 2")).to_be_hidden()
128
- expect(page.get_by_text("Point 4")).to_be_hidden()
129
- expect(page.get_by_text("Point 1")).to_be_visible()
130
- expect(page.get_by_text("Point 3")).to_be_visible()
137
+ expect(page.get_by_role("tooltip", name="Point 2")).to_be_hidden()
138
+ expect(page.get_by_role("tooltip", name="Point 4")).to_be_hidden()
139
+ expect(page.get_by_role("tooltip", name="Point 1")).to_be_visible()
140
+ expect(page.get_by_role("tooltip", name="Point 3")).to_be_visible()
141
+ expect(panel.get_by_text("Point 2")).to_be_hidden()
142
+ expect(panel.get_by_text("Point 4")).to_be_hidden()
143
+ expect(panel.get_by_text("Point 1")).to_be_visible()
144
+ expect(panel.get_by_text("Point 3")).to_be_visible()
131
145
  expect(paths).to_be_visible
132
146
  # Now let's filter
133
147
  odd.click()
@@ -156,7 +170,7 @@ def test_simple_facet_search(live_server, page, map):
156
170
 
157
171
 
158
172
  def test_date_facet_search(live_server, page, map):
159
- map.settings["properties"]["onLoadPanel"] = "facet"
173
+ map.settings["properties"]["onLoadPanel"] = "datafilters"
160
174
  map.settings["properties"]["facetKey"] = "mydate|Date filter|date"
161
175
  map.save()
162
176
  DataLayerFactory(map=map, data=DATALAYER_DATA1)
@@ -174,7 +188,7 @@ def test_date_facet_search(live_server, page, map):
174
188
 
175
189
 
176
190
  def test_choice_with_empty_value(live_server, page, map):
177
- map.settings["properties"]["onLoadPanel"] = "facet"
191
+ map.settings["properties"]["onLoadPanel"] = "datafilters"
178
192
  map.settings["properties"]["facetKey"] = "mytype|My type"
179
193
  map.save()
180
194
  data = copy.deepcopy(DATALAYER_DATA1)
@@ -191,7 +205,7 @@ def test_choice_with_empty_value(live_server, page, map):
191
205
 
192
206
 
193
207
  def test_number_with_zero_value(live_server, page, map):
194
- map.settings["properties"]["onLoadPanel"] = "facet"
208
+ map.settings["properties"]["onLoadPanel"] = "datafilters"
195
209
  map.settings["properties"]["facetKey"] = "mynumber|Filter|number"
196
210
  map.save()
197
211
  data = copy.deepcopy(DATALAYER_DATA1)
@@ -205,3 +219,61 @@ def test_number_with_zero_value(live_server, page, map):
205
219
  page.keyboard.press("Tab") # Move out of the input, so the "change" event is sent
206
220
  markers = page.locator(".leaflet-marker-icon")
207
221
  expect(markers).to_have_count(3)
222
+
223
+
224
+ def test_facets_search_are_persistent_when_closing_panel(live_server, page, map):
225
+ map.settings["properties"]["onLoadPanel"] = "datafilters"
226
+ map.settings["properties"]["facetKey"] = "mytype|My type,mynumber|My Number|number"
227
+ map.save()
228
+ DataLayerFactory(map=map, data=DATALAYER_DATA1)
229
+ DataLayerFactory(map=map, data=DATALAYER_DATA2)
230
+ page.goto(f"{live_server.url}{map.get_absolute_url()}#6/48.948/1.670")
231
+ panel = page.locator(".umap-browser")
232
+
233
+ # Facet values
234
+ odd = page.get_by_label("odd")
235
+ markers = page.locator(".leaflet-marker-icon")
236
+ expect(markers).to_have_count(4)
237
+
238
+ # Datalist in the browser
239
+ expect(panel.get_by_text("Point 1")).to_be_visible()
240
+ expect(panel.get_by_text("Point 2")).to_be_visible()
241
+ expect(panel.get_by_text("Point 3")).to_be_visible()
242
+ expect(panel.get_by_text("Point 4")).to_be_visible()
243
+
244
+ # Now let's filter
245
+ odd.click()
246
+ expect(page.locator("summary")).to_have_attribute("data-badge", " ")
247
+ expect(page.locator(".umap-control-browse")).to_have_attribute("data-badge", " ")
248
+ expect(markers).to_have_count(2)
249
+ expect(panel.get_by_text("Point 2")).to_be_hidden()
250
+ expect(panel.get_by_text("Point 4")).to_be_hidden()
251
+ expect(panel.get_by_text("Point 1")).to_be_visible()
252
+ expect(panel.get_by_text("Point 3")).to_be_visible()
253
+
254
+ # Let's filter using the number facet
255
+ expect(panel.get_by_label("Min")).to_have_value("10")
256
+ expect(panel.get_by_label("Max")).to_have_value("14")
257
+ page.get_by_label("Min").fill("13")
258
+ page.keyboard.press("Tab") # Move out of the input, so the "change" event is sent
259
+ expect(panel.get_by_label("Min")).to_have_attribute("data-modified", "true")
260
+ expect(markers).to_have_count(1)
261
+ expect(panel.get_by_text("Point 2")).to_be_hidden()
262
+ expect(panel.get_by_text("Point 4")).to_be_hidden()
263
+ expect(panel.get_by_text("Point 1")).to_be_hidden()
264
+ expect(panel.get_by_text("Point 3")).to_be_visible()
265
+
266
+ # Close panel
267
+ expect(panel.locator("summary")).to_have_attribute("data-badge", " ")
268
+ expect(page.locator(".umap-control-browse")).to_have_attribute("data-badge", " ")
269
+ page.get_by_role("listitem", name="Close").click()
270
+ page.get_by_role("button", name="See layers").click()
271
+ expect(panel.get_by_label("Min")).to_have_value("13")
272
+ expect(panel.get_by_label("Min")).to_have_attribute("data-modified", "true")
273
+ expect(panel.get_by_label("odd")).to_be_checked()
274
+
275
+ # Datalist in the browser should be inchanged
276
+ expect(panel.get_by_text("Point 2")).to_be_hidden()
277
+ expect(panel.get_by_text("Point 4")).to_be_hidden()
278
+ expect(panel.get_by_text("Point 1")).to_be_hidden()
279
+ expect(panel.get_by_text("Point 3")).to_be_visible()
@@ -188,21 +188,6 @@ def test_remote_layer_should_not_be_used_as_datalayer_for_created_features(
188
188
  expect(layers).to_have_count(2)
189
189
 
190
190
 
191
- def test_can_hide_datalayer_from_caption(openmap, live_server, datalayer, page):
192
- # Add another DataLayer
193
- other = DataLayerFactory(map=openmap, name="Hidden", settings={"inCaption": False})
194
- page.goto(f"{live_server.url}{openmap.get_absolute_url()}")
195
- toggle = page.get_by_text("About").first
196
- expect(toggle).to_be_visible()
197
- toggle.click()
198
- layers = page.locator(".umap-caption .datalayer-legend")
199
- expect(layers).to_have_count(1)
200
- found = page.locator(".panel.left.on").get_by_text(datalayer.name)
201
- expect(found).to_be_visible()
202
- hidden = page.locator(".panel.left.on").get_by_text(other.name)
203
- expect(hidden).to_be_hidden()
204
-
205
-
206
191
  def test_minimap_on_load(map, live_server, datalayer, page):
207
192
  page.goto(f"{live_server.url}{map.get_absolute_url()}")
208
193
  expect(page.locator(".leaflet-control-minimap")).to_be_hidden()
@@ -1,3 +1,4 @@
1
+ import re
1
2
  from copy import deepcopy
2
3
 
3
4
  import pytest
@@ -62,3 +63,19 @@ def test_should_display_tooltip_with_variable(live_server, map, page, bootstrap)
62
63
  map.save()
63
64
  page.goto(f"{live_server.url}{map.get_absolute_url()}")
64
65
  expect(page.get_by_text("Foo test marker")).to_be_visible()
66
+
67
+
68
+ def test_should_open_popup_panel_on_click(live_server, map, page, bootstrap):
69
+ map.settings["properties"]["popupShape"] = "Panel"
70
+ map.save()
71
+ page.goto(f"{live_server.url}{map.get_absolute_url()}")
72
+ panel = page.locator(".panel.left.on")
73
+ expect(panel).to_be_hidden()
74
+ page.locator(".leaflet-marker-icon").click()
75
+ expect(panel).to_be_visible()
76
+ expect(panel).to_have_class(re.compile(".*expanded.*"))
77
+ expect(panel.get_by_role("heading", name="test marker")).to_be_visible()
78
+ expect(panel.get_by_text("Some description")).to_be_visible()
79
+ # Close popup
80
+ page.locator("#map").click()
81
+ expect(panel).to_be_hidden()
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: umap-project
3
- Version: 2.2.2
3
+ Version: 2.3.1
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,7 +19,7 @@ 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.4
22
+ Requires-Dist: django==5.0.6
23
23
  Requires-Dist: pillow==10.3.0
24
24
  Requires-Dist: psycopg==3.1.18
25
25
  Requires-Dist: rcssmin==1.1.2
@@ -29,12 +29,13 @@ Requires-Dist: social-auth-app-django==5.4.1
29
29
  Requires-Dist: social-auth-core==4.5.4
30
30
  Provides-Extra: dev
31
31
  Requires-Dist: djlint==1.34.1; extra == 'dev'
32
- Requires-Dist: hatch==1.9.7; extra == 'dev'
32
+ Requires-Dist: hatch==1.10.0; extra == 'dev'
33
33
  Requires-Dist: isort==5.13.2; extra == 'dev'
34
- Requires-Dist: mkdocs-material==9.5.18; extra == 'dev'
35
- Requires-Dist: mkdocs==1.5.3; extra == 'dev'
34
+ Requires-Dist: mkdocs-material==9.5.23; extra == 'dev'
35
+ Requires-Dist: mkdocs-static-i18n==1.2.3; extra == 'dev'
36
+ Requires-Dist: mkdocs==1.6.0; extra == 'dev'
36
37
  Requires-Dist: pymdown-extensions==10.8.1; extra == 'dev'
37
- Requires-Dist: ruff==0.4.2; extra == 'dev'
38
+ Requires-Dist: ruff==0.4.3; extra == 'dev'
38
39
  Requires-Dist: vermin==1.6.0; extra == 'dev'
39
40
  Provides-Extra: docker
40
41
  Requires-Dist: uwsgi==2.0.25.1; extra == 'docker'
@@ -42,7 +43,7 @@ Provides-Extra: test
42
43
  Requires-Dist: factory-boy==3.2.1; extra == 'test'
43
44
  Requires-Dist: playwright>=1.39; extra == 'test'
44
45
  Requires-Dist: pytest-django==4.8.0; extra == 'test'
45
- Requires-Dist: pytest-playwright==0.4.4; extra == 'test'
46
+ Requires-Dist: pytest-playwright==0.5.0; extra == 'test'
46
47
  Requires-Dist: pytest-xdist<4,>=3.5.0; extra == 'test'
47
48
  Requires-Dist: pytest==8.2.0; extra == 'test'
48
49
  Description-Content-Type: text/markdown