umap-project 3.4.0b3__py3-none-any.whl → 3.4.2__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.
Files changed (185) hide show
  1. umap/__init__.py +1 -1
  2. umap/locale/da/LC_MESSAGES/django.mo +0 -0
  3. umap/locale/da/LC_MESSAGES/django.po +18 -14
  4. umap/locale/en/LC_MESSAGES/django.po +5 -1
  5. umap/locale/es/LC_MESSAGES/django.mo +0 -0
  6. umap/locale/es/LC_MESSAGES/django.po +20 -16
  7. umap/locale/fr/LC_MESSAGES/django.mo +0 -0
  8. umap/locale/fr/LC_MESSAGES/django.po +18 -14
  9. umap/locale/pl/LC_MESSAGES/django.mo +0 -0
  10. umap/locale/pl/LC_MESSAGES/django.po +72 -71
  11. umap/static/umap/content.css +0 -3
  12. umap/static/umap/css/bar.css +9 -6
  13. umap/static/umap/css/form.css +25 -9
  14. umap/static/umap/css/popup.css +1 -0
  15. umap/static/umap/js/components/copiable.js +47 -0
  16. umap/static/umap/js/modules/autocomplete.js +31 -58
  17. umap/static/umap/js/modules/browser.js +4 -4
  18. umap/static/umap/js/modules/data/features.js +32 -35
  19. umap/static/umap/js/modules/data/fields.js +189 -23
  20. umap/static/umap/js/modules/data/layer.js +72 -87
  21. umap/static/umap/js/modules/domutils.js +21 -1
  22. umap/static/umap/js/modules/filters.js +13 -40
  23. umap/static/umap/js/modules/form/fields.js +4 -4
  24. umap/static/umap/js/modules/formatter.js +9 -1
  25. umap/static/umap/js/modules/help.js +12 -13
  26. umap/static/umap/js/modules/importer.js +17 -26
  27. umap/static/umap/js/modules/importers/banfr.js +0 -1
  28. umap/static/umap/js/modules/importers/cadastrefr.js +19 -19
  29. umap/static/umap/js/modules/importers/communesfr.js +7 -8
  30. umap/static/umap/js/modules/importers/datasets.js +14 -14
  31. umap/static/umap/js/modules/importers/geodatamine.js +20 -22
  32. umap/static/umap/js/modules/importers/opendata.js +10 -0
  33. umap/static/umap/js/modules/importers/overpass.js +19 -18
  34. umap/static/umap/js/modules/managers.js +1 -1
  35. umap/static/umap/js/modules/permissions.js +5 -3
  36. umap/static/umap/js/modules/rendering/controls.js +2 -2
  37. umap/static/umap/js/modules/rendering/icon.js +5 -9
  38. umap/static/umap/js/modules/rendering/layers/base.js +1 -1
  39. umap/static/umap/js/modules/rendering/layers/classified.js +15 -10
  40. umap/static/umap/js/modules/rendering/layers/heat.js +1 -0
  41. umap/static/umap/js/modules/rendering/map.js +22 -22
  42. umap/static/umap/js/modules/rendering/popup.js +6 -3
  43. umap/static/umap/js/modules/rendering/template.js +28 -34
  44. umap/static/umap/js/modules/rendering/ui.js +1 -2
  45. umap/static/umap/js/modules/rules.js +34 -41
  46. umap/static/umap/js/modules/schema.js +0 -7
  47. umap/static/umap/js/modules/share.js +36 -69
  48. umap/static/umap/js/modules/slideshow.js +3 -3
  49. umap/static/umap/js/modules/tableeditor.js +0 -1
  50. umap/static/umap/js/modules/ui/bar.js +51 -32
  51. umap/static/umap/js/modules/ui/panel.js +26 -21
  52. umap/static/umap/js/modules/ui/tooltip.js +1 -1
  53. umap/static/umap/js/modules/umap.js +75 -80
  54. umap/static/umap/js/modules/utils.js +12 -3
  55. umap/static/umap/js/umap.controls.js +33 -14
  56. umap/static/umap/locale/am_ET.js +6 -4
  57. umap/static/umap/locale/am_ET.json +6 -4
  58. umap/static/umap/locale/ar.js +6 -4
  59. umap/static/umap/locale/ar.json +6 -4
  60. umap/static/umap/locale/ast.js +6 -4
  61. umap/static/umap/locale/ast.json +6 -4
  62. umap/static/umap/locale/bg.js +6 -4
  63. umap/static/umap/locale/bg.json +6 -4
  64. umap/static/umap/locale/br.js +19 -8
  65. umap/static/umap/locale/br.json +19 -8
  66. umap/static/umap/locale/ca.js +6 -4
  67. umap/static/umap/locale/ca.json +6 -4
  68. umap/static/umap/locale/cs_CZ.js +7 -5
  69. umap/static/umap/locale/cs_CZ.json +7 -5
  70. umap/static/umap/locale/da.js +8 -6
  71. umap/static/umap/locale/da.json +8 -6
  72. umap/static/umap/locale/de.js +38 -36
  73. umap/static/umap/locale/de.json +38 -36
  74. umap/static/umap/locale/el.js +7 -5
  75. umap/static/umap/locale/el.json +7 -5
  76. umap/static/umap/locale/en.js +7 -5
  77. umap/static/umap/locale/en.json +7 -5
  78. umap/static/umap/locale/en_US.json +6 -4
  79. umap/static/umap/locale/es.js +19 -17
  80. umap/static/umap/locale/es.json +19 -17
  81. umap/static/umap/locale/et.js +7 -5
  82. umap/static/umap/locale/et.json +7 -5
  83. umap/static/umap/locale/eu.js +23 -21
  84. umap/static/umap/locale/eu.json +23 -21
  85. umap/static/umap/locale/fa_IR.js +7 -5
  86. umap/static/umap/locale/fa_IR.json +7 -5
  87. umap/static/umap/locale/fi.js +6 -4
  88. umap/static/umap/locale/fi.json +6 -4
  89. umap/static/umap/locale/fr.js +8 -6
  90. umap/static/umap/locale/fr.json +8 -6
  91. umap/static/umap/locale/gl.js +147 -145
  92. umap/static/umap/locale/gl.json +147 -145
  93. umap/static/umap/locale/he.js +6 -4
  94. umap/static/umap/locale/he.json +6 -4
  95. umap/static/umap/locale/hr.js +6 -4
  96. umap/static/umap/locale/hr.json +6 -4
  97. umap/static/umap/locale/hu.js +7 -5
  98. umap/static/umap/locale/hu.json +7 -5
  99. umap/static/umap/locale/id.js +6 -4
  100. umap/static/umap/locale/id.json +6 -4
  101. umap/static/umap/locale/is.js +7 -5
  102. umap/static/umap/locale/is.json +7 -5
  103. umap/static/umap/locale/it.js +7 -5
  104. umap/static/umap/locale/it.json +7 -5
  105. umap/static/umap/locale/ja.js +6 -4
  106. umap/static/umap/locale/ja.json +6 -4
  107. umap/static/umap/locale/ko.js +6 -4
  108. umap/static/umap/locale/ko.json +6 -4
  109. umap/static/umap/locale/lt.js +6 -4
  110. umap/static/umap/locale/lt.json +6 -4
  111. umap/static/umap/locale/ms.js +7 -5
  112. umap/static/umap/locale/ms.json +7 -5
  113. umap/static/umap/locale/nl.js +7 -5
  114. umap/static/umap/locale/nl.json +7 -5
  115. umap/static/umap/locale/no.js +6 -4
  116. umap/static/umap/locale/no.json +6 -4
  117. umap/static/umap/locale/pl.js +53 -51
  118. umap/static/umap/locale/pl.json +53 -51
  119. umap/static/umap/locale/pl_PL.json +6 -4
  120. umap/static/umap/locale/pt.js +7 -5
  121. umap/static/umap/locale/pt.json +7 -5
  122. umap/static/umap/locale/pt_BR.js +6 -4
  123. umap/static/umap/locale/pt_BR.json +6 -4
  124. umap/static/umap/locale/pt_PT.js +6 -4
  125. umap/static/umap/locale/pt_PT.json +6 -4
  126. umap/static/umap/locale/ro.js +6 -4
  127. umap/static/umap/locale/ro.json +6 -4
  128. umap/static/umap/locale/ru.js +6 -4
  129. umap/static/umap/locale/ru.json +6 -4
  130. umap/static/umap/locale/sk_SK.js +6 -4
  131. umap/static/umap/locale/sk_SK.json +6 -4
  132. umap/static/umap/locale/sl.js +6 -4
  133. umap/static/umap/locale/sl.json +6 -4
  134. umap/static/umap/locale/sr.js +6 -4
  135. umap/static/umap/locale/sr.json +6 -4
  136. umap/static/umap/locale/sv.js +6 -4
  137. umap/static/umap/locale/sv.json +6 -4
  138. umap/static/umap/locale/th_TH.js +6 -4
  139. umap/static/umap/locale/th_TH.json +6 -4
  140. umap/static/umap/locale/tr.js +6 -4
  141. umap/static/umap/locale/tr.json +6 -4
  142. umap/static/umap/locale/uk_UA.js +6 -4
  143. umap/static/umap/locale/uk_UA.json +6 -4
  144. umap/static/umap/locale/vi.js +6 -4
  145. umap/static/umap/locale/vi.json +6 -4
  146. umap/static/umap/locale/vi_VN.json +6 -4
  147. umap/static/umap/locale/zh.js +6 -4
  148. umap/static/umap/locale/zh.json +6 -4
  149. umap/static/umap/locale/zh_CN.json +6 -4
  150. umap/static/umap/locale/zh_TW.Big5.json +6 -4
  151. umap/static/umap/locale/zh_TW.js +20 -18
  152. umap/static/umap/locale/zh_TW.json +20 -18
  153. umap/static/umap/map.css +5 -4
  154. umap/static/umap/unittests/utils.js +7 -7
  155. umap/templates/umap/content_footer.html +1 -0
  156. umap/templates/umap/css.html +0 -2
  157. umap/templates/umap/js.html +1 -3
  158. umap/tests/integration/conftest.py +3 -2
  159. umap/tests/integration/test_anonymous_owned_map.py +1 -1
  160. umap/tests/integration/test_conditional_rules.py +106 -51
  161. umap/tests/integration/test_draw_polygon.py +4 -0
  162. umap/tests/integration/test_draw_polyline.py +11 -0
  163. umap/tests/integration/test_edit_datalayer.py +1 -1
  164. umap/tests/integration/test_fields.py +19 -0
  165. umap/tests/integration/test_iframe.py +1 -1
  166. umap/tests/integration/test_import.py +23 -0
  167. umap/tests/integration/test_map.py +2 -2
  168. umap/tests/integration/test_owned_map.py +2 -2
  169. umap/tests/integration/test_popup.py +31 -0
  170. umap/tests/integration/test_remote_data.py +4 -4
  171. umap/tests/integration/test_search.py +41 -0
  172. umap/tests/integration/test_share.py +2 -2
  173. umap/tests/integration/test_team.py +1 -1
  174. umap/tests/integration/test_websocket_sync.py +6 -1
  175. umap/tests/test_utils.py +4 -1
  176. umap/utils.py +1 -0
  177. {umap_project-3.4.0b3.dist-info → umap_project-3.4.2.dist-info}/METADATA +15 -15
  178. {umap_project-3.4.0b3.dist-info → umap_project-3.4.2.dist-info}/RECORD +181 -183
  179. umap/static/umap/js/umap.core.js +0 -93
  180. umap/static/umap/vendors/editinosm/Leaflet.EditInOSM.css +0 -46
  181. umap/static/umap/vendors/editinosm/Leaflet.EditInOSM.js +0 -240
  182. umap/static/umap/vendors/editinosm/edit-in-osm.png +0 -0
  183. {umap_project-3.4.0b3.dist-info → umap_project-3.4.2.dist-info}/WHEEL +0 -0
  184. {umap_project-3.4.0b3.dist-info → umap_project-3.4.2.dist-info}/entry_points.txt +0 -0
  185. {umap_project-3.4.0b3.dist-info → umap_project-3.4.2.dist-info}/licenses/LICENSE +0 -0
@@ -120,28 +120,28 @@ describe('Utils', () => {
120
120
  it('should handle iframe', () => {
121
121
  assert.equal(
122
122
  Utils.toHTML('A simple iframe: {{{http://osm.org/pouet.html}}}'),
123
- 'A simple iframe: <div><iframe height="300px" width="100%" src="http://osm.org/pouet.html" frameborder="0"></iframe></div>'
123
+ 'A simple iframe: <div><iframe style="width: 100%; height: 300px; border: 0;" src="http://osm.org/pouet.html" allowfullscreen=""></iframe></div>'
124
124
  )
125
125
  })
126
126
 
127
127
  it('should handle iframe with height', () => {
128
128
  assert.equal(
129
129
  Utils.toHTML('A simple iframe: {{{http://osm.org/pouet.html|200}}}'),
130
- 'A simple iframe: <div><iframe height="200px" width="100%" src="http://osm.org/pouet.html" frameborder="0"></iframe></div>'
130
+ 'A simple iframe: <div><iframe style="width: 100%; height: 200px; border: 0;" src="http://osm.org/pouet.html" allowfullscreen=""></iframe></div>'
131
131
  )
132
132
  })
133
133
 
134
134
  it('should handle iframe with height and width', () => {
135
135
  assert.equal(
136
136
  Utils.toHTML('A simple iframe: {{{http://osm.org/pouet.html|200*400}}}'),
137
- 'A simple iframe: <div><iframe height="200px" width="400px" src="http://osm.org/pouet.html" frameborder="0"></iframe></div>'
137
+ 'A simple iframe: <div><iframe style="width: 400px; height: 200px; border: 0;" src="http://osm.org/pouet.html" allowfullscreen=""></iframe></div>'
138
138
  )
139
139
  })
140
140
 
141
141
  it('should handle iframe with height with px', () => {
142
142
  assert.equal(
143
143
  Utils.toHTML('A simple iframe: {{{http://osm.org/pouet.html|200px}}}'),
144
- 'A simple iframe: <div><iframe height="200px" width="100%" src="http://osm.org/pouet.html" frameborder="0"></iframe></div>'
144
+ 'A simple iframe: <div><iframe style="width: 100%; height: 200px; border: 0;" src="http://osm.org/pouet.html" allowfullscreen=""></iframe></div>'
145
145
  )
146
146
  })
147
147
 
@@ -150,7 +150,7 @@ describe('Utils', () => {
150
150
  Utils.toHTML(
151
151
  'A simple iframe: {{{https://osm.org/?url=https%3A//anotherurl.com}}}'
152
152
  ),
153
- 'A simple iframe: <div><iframe height="300px" width="100%" src="https://osm.org/?url=https%3A//anotherurl.com" frameborder="0"></iframe></div>'
153
+ 'A simple iframe: <div><iframe style="width: 100%; height: 300px; border: 0;" src="https://osm.org/?url=https%3A//anotherurl.com" allowfullscreen=""></iframe></div>'
154
154
  )
155
155
  })
156
156
 
@@ -159,7 +159,7 @@ describe('Utils', () => {
159
159
  Utils.toHTML(
160
160
  'A double iframe: {{{https://osm.org/pouet}}}{{{https://osm.org/boudin}}}'
161
161
  ),
162
- 'A double iframe: <div><iframe height="300px" width="100%" src="https://osm.org/pouet" frameborder="0"></iframe></div><div><iframe height="300px" width="100%" src="https://osm.org/boudin" frameborder="0"></iframe></div>'
162
+ 'A double iframe: <div><iframe style="width: 100%; height: 300px; border: 0;" src="https://osm.org/pouet" allowfullscreen=""></iframe></div><div><iframe style="width: 100%; height: 300px; border: 0;" src="https://osm.org/boudin" allowfullscreen=""></iframe></div>'
163
163
  )
164
164
  })
165
165
 
@@ -168,7 +168,7 @@ describe('Utils', () => {
168
168
  Utils.toHTML(
169
169
  'An iframe with query string: {{{https://osm.org/pouet.html?name=foobar&description=baz baz}}}'
170
170
  ),
171
- 'An iframe with query string: <div><iframe height="300px" width="100%" src="https://osm.org/pouet.html?name=foobar&amp;description=baz baz" frameborder="0"></iframe></div>'
171
+ 'An iframe with query string: <div><iframe style="width: 100%; height: 300px; border: 0;" src="https://osm.org/pouet.html?name=foobar&amp;description=baz baz" allowfullscreen=""></iframe></div>'
172
172
  )
173
173
  })
174
174
 
@@ -7,6 +7,7 @@
7
7
  {% if UMAP_HOST_INFOS.url and UMAP_HOST_INFOS.name %}<span>{% trans "Hosted by" %} <a href="{{ UMAP_HOST_INFOS.url }}">{{ UMAP_HOST_INFOS.name }}</a></span>{% endif %}
8
8
  {% if UMAP_HOST_INFOS.email %}<a href="mailto:{{ UMAP_HOST_INFOS.email }}">{% trans "Contact" %}</a>{% endif %}
9
9
  {% if UMAP_HELP_URL %}<a href="{{ UMAP_HELP_URL }}">{% trans "Help" %}</a>{% endif %}
10
+ {% if UMAP_HOST_INFOS.tos %}<a href="{{ UMAP_HOST_INFOS.tos }}">{% trans "Terms of Service" %}</a>{% endif %}
10
11
  {% get_language_info_list for LANGUAGES as languages %}
11
12
  <form action="{% url "set_language" %}" method="post" class="i18n_switch">
12
13
  {% csrf_token %}
@@ -4,8 +4,6 @@
4
4
 
5
5
  <link rel="stylesheet"
6
6
  href="{% static 'umap/vendors/leaflet/leaflet.css' %}" />
7
- <link rel="stylesheet"
8
- href="{% static 'umap/vendors/editinosm/Leaflet.EditInOSM.css' %}" />
9
7
  <link rel="stylesheet"
10
8
  href="{% static 'umap/vendors/minimap/Control.MiniMap.min.css' %}" />
11
9
  <link rel="stylesheet"
@@ -17,8 +17,6 @@
17
17
  <script src="{% static 'umap/vendors/editable/Leaflet.Editable.js' %}" defer></script>
18
18
  <script type="module" src="{% static 'umap/js/modules/global.js' %}" defer></script>
19
19
  <script src="{% static 'umap/vendors/hash/leaflet-hash.js' %}" defer></script>
20
- <script src="{% static 'umap/vendors/editinosm/Leaflet.EditInOSM.js' %}"
21
- defer></script>
22
20
  <script src="{% static 'umap/vendors/minimap/Control.MiniMap.min.js' %}"
23
21
  defer></script>
24
22
  <script src="{% static 'umap/vendors/csv2geojson/csv2geojson.js' %}" defer></script>
@@ -36,8 +34,8 @@
36
34
  defer></script>
37
35
  <script src="{% static 'umap/vendors/simple-statistics/simple-statistics.min.js' %}"
38
36
  defer></script>
39
- <script src="{% static 'umap/js/umap.core.js' %}" defer></script>
40
37
  <script src="{% static 'umap/js/umap.controls.js' %}" defer></script>
41
38
  <script type="module" src="{% static 'umap/js/components/fragment.js' %}" defer></script>
42
39
  <script type="module" src="{% static 'umap/js/components/modal.js' %}" defer></script>
40
+ <script type="module" src="{% static 'umap/js/components/copiable.js' %}" defer></script>
43
41
  {% endautoescape %}
@@ -26,8 +26,9 @@ def set_timeout(context):
26
26
 
27
27
  @pytest.fixture
28
28
  def new_page(context):
29
- def make_page(prefix="console"):
30
- page = context.new_page()
29
+ def make_page(prefix="console", custom_context=None):
30
+ _context = custom_context or context
31
+ page = _context.new_page()
31
32
  page.on(
32
33
  "console",
33
34
  lambda msg: print(f"{prefix}: {msg.text}")
@@ -133,7 +133,7 @@ def test_can_change_perms_after_create(tilelayer, live_server, page):
133
133
  page.goto(f"{live_server.url}/en/map/new")
134
134
  # Create a layer
135
135
  page.get_by_title("Manage layers").click()
136
- page.get_by_title("Add a layer").click()
136
+ page.get_by_role("button", name="Add a layer").click()
137
137
  page.locator("input[name=name]").fill("Layer 1")
138
138
  expect(
139
139
  page.get_by_role("button", name="Visibility: Draft (private)")
@@ -8,13 +8,6 @@ from ..base import DataLayerFactory
8
8
  pytestmark = pytest.mark.django_db
9
9
 
10
10
 
11
- def getColors(elements):
12
- return [
13
- el.evaluate("e => window.getComputedStyle(e).backgroundColor")
14
- for el in elements.all()
15
- ]
16
-
17
-
18
11
  DATALAYER_DATA1 = {
19
12
  "type": "FeatureCollection",
20
13
  "features": [
@@ -96,6 +89,9 @@ DATALAYER_DATA2 = {
96
89
 
97
90
 
98
91
  def test_simple_equal_rule_at_load(live_server, page, map):
92
+ map.settings["properties"]["fields"] = [
93
+ {"key": "mytype", "type": "String"},
94
+ ]
99
95
  map.settings["properties"]["rules"] = [
100
96
  {"condition": "mytype=odd", "properties": {"color": "aliceblue"}}
101
97
  ]
@@ -103,13 +99,18 @@ def test_simple_equal_rule_at_load(live_server, page, map):
103
99
  DataLayerFactory(map=map, data=DATALAYER_DATA1)
104
100
  DataLayerFactory(map=map, data=DATALAYER_DATA2)
105
101
  page.goto(f"{live_server.url}{map.get_absolute_url()}#6/48.948/1.670")
106
- markers = page.locator(".leaflet-marker-icon .icon-container")
102
+ markers = page.locator(".leaflet-marker-icon")
107
103
  expect(markers).to_have_count(5)
108
- colors = getColors(markers)
109
- assert colors.count("rgb(240, 248, 255)") == 3
104
+ markers = page.locator(
105
+ '.leaflet-marker-icon [style*="background-color: aliceblue"]'
106
+ )
107
+ expect(markers).to_have_count(3)
110
108
 
111
109
 
112
- def test_simple_not_equal_rule_at_load(live_server, page, map):
110
+ def test_simple_not_equal_rule_at_load(live_server, page, map, wait_for_loaded):
111
+ map.settings["properties"]["fields"] = [
112
+ {"key": "mytype", "type": "String"},
113
+ ]
113
114
  map.settings["properties"]["rules"] = [
114
115
  {"condition": "mytype!=even", "properties": {"color": "aliceblue"}}
115
116
  ]
@@ -117,13 +118,19 @@ def test_simple_not_equal_rule_at_load(live_server, page, map):
117
118
  DataLayerFactory(map=map, data=DATALAYER_DATA1)
118
119
  DataLayerFactory(map=map, data=DATALAYER_DATA2)
119
120
  page.goto(f"{live_server.url}{map.get_absolute_url()}#6/48.948/1.670")
120
- markers = page.locator(".leaflet-marker-icon .icon-container")
121
+ wait_for_loaded(page)
122
+ markers = page.locator(".leaflet-marker-icon")
121
123
  expect(markers).to_have_count(5)
122
- colors = getColors(markers)
123
- assert colors.count("rgb(240, 248, 255)") == 3
124
+ markers = page.locator(
125
+ '.leaflet-marker-icon [style*="background-color: aliceblue"]'
126
+ )
127
+ expect(markers).to_have_count(3)
124
128
 
125
129
 
126
130
  def test_gt_rule_with_number_at_load(live_server, page, map):
131
+ map.settings["properties"]["fields"] = [
132
+ {"key": "mynumber", "type": "Number"},
133
+ ]
127
134
  map.settings["properties"]["rules"] = [
128
135
  {"condition": "mynumber>10", "properties": {"color": "aliceblue"}}
129
136
  ]
@@ -133,11 +140,16 @@ def test_gt_rule_with_number_at_load(live_server, page, map):
133
140
  page.goto(f"{live_server.url}{map.get_absolute_url()}#6/48.948/1.670")
134
141
  markers = page.locator(".leaflet-marker-icon .icon-container")
135
142
  expect(markers).to_have_count(5)
136
- colors = getColors(markers)
137
- assert colors.count("rgb(240, 248, 255)") == 2
143
+ markers = page.locator(
144
+ '.leaflet-marker-icon [style*="background-color: aliceblue"]'
145
+ )
146
+ expect(markers).to_have_count(2)
138
147
 
139
148
 
140
149
  def test_lt_rule_with_number_at_load(live_server, page, map):
150
+ map.settings["properties"]["fields"] = [
151
+ {"key": "mynumber", "type": "Number"},
152
+ ]
141
153
  map.settings["properties"]["rules"] = [
142
154
  {"condition": "mynumber<14", "properties": {"color": "aliceblue"}}
143
155
  ]
@@ -147,8 +159,10 @@ def test_lt_rule_with_number_at_load(live_server, page, map):
147
159
  page.goto(f"{live_server.url}{map.get_absolute_url()}#6/48.948/1.670")
148
160
  markers = page.locator(".leaflet-marker-icon .icon-container")
149
161
  expect(markers).to_have_count(5)
150
- colors = getColors(markers)
151
- assert colors.count("rgb(240, 248, 255)") == 4
162
+ markers = page.locator(
163
+ '.leaflet-marker-icon [style*="background-color: aliceblue"]'
164
+ )
165
+ expect(markers).to_have_count(4)
152
166
 
153
167
 
154
168
  def test_lt_rule_with_float_at_load(live_server, page, map):
@@ -161,8 +175,10 @@ def test_lt_rule_with_float_at_load(live_server, page, map):
161
175
  page.goto(f"{live_server.url}{map.get_absolute_url()}#6/48.948/1.670")
162
176
  markers = page.locator(".leaflet-marker-icon .icon-container")
163
177
  expect(markers).to_have_count(5)
164
- colors = getColors(markers)
165
- assert colors.count("rgb(240, 248, 255)") == 4
178
+ markers = page.locator(
179
+ '.leaflet-marker-icon [style*="background-color: aliceblue"]'
180
+ )
181
+ expect(markers).to_have_count(4)
166
182
 
167
183
 
168
184
  def test_equal_rule_with_boolean_at_load(live_server, page, map):
@@ -175,8 +191,10 @@ def test_equal_rule_with_boolean_at_load(live_server, page, map):
175
191
  page.goto(f"{live_server.url}{map.get_absolute_url()}#6/48.948/1.670")
176
192
  markers = page.locator(".leaflet-marker-icon .icon-container")
177
193
  expect(markers).to_have_count(5)
178
- colors = getColors(markers)
179
- assert colors.count("rgb(240, 248, 255)") == 2
194
+ markers = page.locator(
195
+ '.leaflet-marker-icon [style*="background-color: aliceblue"]'
196
+ )
197
+ expect(markers).to_have_count(2)
180
198
 
181
199
 
182
200
  def test_equal_rule_with_boolean_not_true_at_load(live_server, page, map):
@@ -189,8 +207,10 @@ def test_equal_rule_with_boolean_not_true_at_load(live_server, page, map):
189
207
  page.goto(f"{live_server.url}{map.get_absolute_url()}#6/48.948/1.670")
190
208
  markers = page.locator(".leaflet-marker-icon .icon-container")
191
209
  expect(markers).to_have_count(5)
192
- colors = getColors(markers)
193
- assert colors.count("rgb(240, 248, 255)") == 3
210
+ markers = page.locator(
211
+ '.leaflet-marker-icon [style*="background-color: aliceblue"]'
212
+ )
213
+ expect(markers).to_have_count(3)
194
214
 
195
215
 
196
216
  def test_equal_rule_with_boolean_false_at_load(live_server, page, map):
@@ -203,8 +223,10 @@ def test_equal_rule_with_boolean_false_at_load(live_server, page, map):
203
223
  page.goto(f"{live_server.url}{map.get_absolute_url()}#6/48.948/1.670")
204
224
  markers = page.locator(".leaflet-marker-icon .icon-container")
205
225
  expect(markers).to_have_count(5)
206
- colors = getColors(markers)
207
- assert colors.count("rgb(240, 248, 255)") == 1
226
+ markers = page.locator(
227
+ '.leaflet-marker-icon [style*="background-color: aliceblue"]'
228
+ )
229
+ expect(markers).to_have_count(1)
208
230
 
209
231
 
210
232
  def test_equal_rule_with_boolean_not_false_at_load(live_server, page, map):
@@ -217,8 +239,10 @@ def test_equal_rule_with_boolean_not_false_at_load(live_server, page, map):
217
239
  page.goto(f"{live_server.url}{map.get_absolute_url()}#6/48.948/1.670")
218
240
  markers = page.locator(".leaflet-marker-icon .icon-container")
219
241
  expect(markers).to_have_count(5)
220
- colors = getColors(markers)
221
- assert colors.count("rgb(240, 248, 255)") == 4
242
+ markers = page.locator(
243
+ '.leaflet-marker-icon [style*="background-color: aliceblue"]'
244
+ )
245
+ expect(markers).to_have_count(4)
222
246
 
223
247
 
224
248
  def test_empty_rule_at_load(live_server, page, map):
@@ -231,8 +255,10 @@ def test_empty_rule_at_load(live_server, page, map):
231
255
  page.goto(f"{live_server.url}{map.get_absolute_url()}#6/48.948/1.670")
232
256
  markers = page.locator(".leaflet-marker-icon .icon-container")
233
257
  expect(markers).to_have_count(5)
234
- colors = getColors(markers)
235
- assert colors.count("rgb(240, 248, 255)") == 3
258
+ markers = page.locator(
259
+ '.leaflet-marker-icon [style*="background-color: aliceblue"]'
260
+ )
261
+ expect(markers).to_have_count(3)
236
262
 
237
263
 
238
264
  def test_not_empty_rule_at_load(live_server, page, map):
@@ -245,8 +271,10 @@ def test_not_empty_rule_at_load(live_server, page, map):
245
271
  page.goto(f"{live_server.url}{map.get_absolute_url()}#6/48.948/1.670")
246
272
  markers = page.locator(".leaflet-marker-icon .icon-container")
247
273
  expect(markers).to_have_count(5)
248
- colors = getColors(markers)
249
- assert colors.count("rgb(240, 248, 255)") == 2
274
+ markers = page.locator(
275
+ '.leaflet-marker-icon [style*="background-color: aliceblue"]'
276
+ )
277
+ expect(markers).to_have_count(2)
250
278
 
251
279
 
252
280
  def test_can_create_new_rule(live_server, page, openmap):
@@ -263,11 +291,15 @@ def test_can_create_new_rule(live_server, page, openmap):
263
291
  page.locator("input[name=condition]").fill("mytype=odd")
264
292
  page.locator(".umap-field-color .define").first.click()
265
293
  page.get_by_title("AliceBlue").first.click()
266
- colors = getColors(markers)
267
- assert colors.count("rgb(240, 248, 255)") == 3
294
+ markers = page.locator(
295
+ '.leaflet-marker-icon [style*="background-color: aliceblue"]'
296
+ )
297
+ expect(markers).to_have_count(3)
268
298
  page.locator(".edit-undo").click()
269
- colors = getColors(markers)
270
- assert colors.count("rgb(240, 248, 255)") == 0
299
+ markers = page.locator(
300
+ '.leaflet-marker-icon [style*="background-color: aliceblue"]'
301
+ )
302
+ expect(markers).to_have_count(0)
271
303
 
272
304
 
273
305
  def test_can_deactivate_rule_from_list(live_server, page, openmap):
@@ -280,20 +312,36 @@ def test_can_deactivate_rule_from_list(live_server, page, openmap):
280
312
  page.goto(f"{live_server.url}{openmap.get_absolute_url()}#6/48.948/1.670")
281
313
  markers = page.locator(".leaflet-marker-icon .icon-container")
282
314
  expect(markers).to_have_count(5)
283
- colors = getColors(markers)
284
- assert colors.count("rgb(240, 248, 255)") == 3
315
+ markers = page.locator(
316
+ '.leaflet-marker-icon [style*="background-color: aliceblue"]'
317
+ )
318
+ expect(markers).to_have_count(3)
285
319
  page.get_by_role("button", name="Edit").click()
286
320
  page.get_by_role("button", name="Map advanced properties").click()
287
321
  page.get_by_text("Conditional style rules").click()
288
322
  page.get_by_role("button", name="Toggle rule").click()
289
- colors = getColors(markers)
290
- assert colors.count("rgb(240, 248, 255)") == 0
323
+ markers = page.locator(
324
+ '.leaflet-marker-icon [style*="background-color: aliceblue"]'
325
+ )
326
+ expect(markers).to_have_count(0)
291
327
  page.get_by_role("button", name="Toggle rule").click()
292
- colors = getColors(markers)
293
- assert colors.count("rgb(240, 248, 255)") == 3
328
+ markers = page.locator(
329
+ '.leaflet-marker-icon [style*="background-color: aliceblue"]'
330
+ )
331
+ expect(markers).to_have_count(3)
294
332
 
295
333
 
296
334
  def test_autocomplete_datalist(live_server, page, openmap):
335
+ openmap.settings["properties"]["fields"] = [
336
+ {"key": "myboolean", "type": "String"},
337
+ {"key": "mytype", "type": "String"},
338
+ {"key": "mynumber", "type": "String"},
339
+ {"key": "mydate", "type": "String"},
340
+ {"key": "name", "type": "String"},
341
+ {"key": "maybeempty", "type": "String"},
342
+ {"key": "onlyinone", "type": "String"},
343
+ ]
344
+ openmap.save()
297
345
  DataLayerFactory(map=openmap, data=DATALAYER_DATA1)
298
346
  page.goto(f"{live_server.url}{openmap.get_absolute_url()}?edit#6/48.948/1.670")
299
347
  page.get_by_role("button", name="Map advanced properties").click()
@@ -335,10 +383,12 @@ def test_can_combine_rules(live_server, page, map):
335
383
  drops = page.locator(".umap-drop-icon .icon-container")
336
384
  expect(markers).to_have_count(5)
337
385
  expect(drops).to_have_count(2)
338
- colors = getColors(markers)
339
- assert colors.count("rgb(240, 248, 255)") == 3
340
- colors = getColors(drops)
341
- assert colors.count("rgb(240, 248, 255)") == 2
386
+ markers = page.locator(
387
+ '.leaflet-marker-icon [style*="background-color: aliceblue"]'
388
+ )
389
+ expect(markers).to_have_count(3)
390
+ drops = page.locator('.umap-drop-icon [style*="background-color: aliceblue"]')
391
+ expect(drops).to_have_count(2)
342
392
 
343
393
 
344
394
  def test_first_matching_rule_wins_on_given_property(live_server, page, map):
@@ -352,8 +402,10 @@ def test_first_matching_rule_wins_on_given_property(live_server, page, map):
352
402
  page.goto(f"{live_server.url}{map.get_absolute_url()}#6/48.948/1.670")
353
403
  markers = page.locator(".leaflet-marker-icon .icon-container")
354
404
  expect(markers).to_have_count(5)
355
- colors = getColors(markers)
356
- assert colors.count("rgb(240, 248, 255)") == 3
405
+ markers = page.locator(
406
+ '.leaflet-marker-icon [style*="background-color: aliceblue"]'
407
+ )
408
+ expect(markers).to_have_count(3)
357
409
 
358
410
 
359
411
  def test_rules_from_datalayer(live_server, page, map):
@@ -370,11 +422,14 @@ def test_rules_from_datalayer(live_server, page, map):
370
422
  page.goto(f"{live_server.url}{map.get_absolute_url()}#6/48.948/1.670")
371
423
  markers = page.locator(".leaflet-marker-icon .icon-container")
372
424
  expect(markers).to_have_count(5)
373
- colors = getColors(markers)
374
425
  # Alice Blue should only affect layer 1
375
- assert colors.count("rgb(240, 248, 255)") == 1
426
+ markers = page.locator(
427
+ '.leaflet-marker-icon [style*="background-color: aliceblue"]'
428
+ )
429
+ expect(markers).to_have_count(1)
376
430
  # Dark Red as for map global rules
377
- assert colors.count("rgb(139, 0, 0)") == 2
431
+ markers = page.locator('.leaflet-marker-icon [style*="background-color: darkred"]')
432
+ expect(markers).to_have_count(2)
378
433
 
379
434
 
380
435
  def test_rules_in_caption(live_server, page, map):
@@ -176,6 +176,7 @@ def test_can_draw_hole(page, live_server, tilelayer):
176
176
  expect(polygons).to_have_count(1)
177
177
  expect(vertices).to_have_count(4)
178
178
 
179
+ page.wait_for_timeout(300) # Time for the panel animation to finish
179
180
  # First vertex of the hole will be created here
180
181
  map.click(position={"x": 180, "y": 120}, button="right")
181
182
  page.get_by_role("button", name="Start a hole here").click()
@@ -373,6 +374,7 @@ def test_can_clone_polygon(live_server, page, tilelayer, settings):
373
374
  map.click(position={"x": 100, "y": 100})
374
375
  # Click again to finish
375
376
  map.click(position={"x": 100, "y": 100})
377
+ page.wait_for_timeout(300) # Time for the panel animation to finish
376
378
  expect(polygons).to_have_count(1)
377
379
  polygons.first.click(button="right")
378
380
  page.get_by_role("button", name="Clone this feature").click()
@@ -399,6 +401,7 @@ def test_can_transform_polygon_to_line(live_server, page, tilelayer, settings):
399
401
  map.click(position={"x": 100, "y": 100})
400
402
  expect(polygons).to_have_count(1)
401
403
  expect(paths).to_have_count(1)
404
+ page.wait_for_timeout(300) # Time for the panel animation to finish
402
405
  polygons.first.click(button="right")
403
406
  page.get_by_role("button", name="Transform to lines").click()
404
407
  # No more polygons (will fill), but one path, it must be a line
@@ -471,6 +474,7 @@ def test_vertexmarker_not_shown_if_too_many(live_server, map, page, settings):
471
474
  settings.UMAP_ALLOW_ANONYMOUS = True
472
475
  page.goto(f"{live_server.url}/en/map/new/#15/48.4395/3.3189")
473
476
  page.get_by_title("Import data").click()
477
+ page.wait_for_timeout(300) # Time for the panel animation to finish
474
478
  page.locator(".umap-import textarea").fill(geojson)
475
479
  page.locator('select[name="format"]').select_option("geojson")
476
480
  page.get_by_role("button", name="Import data", exact=True).click()
@@ -261,6 +261,9 @@ def test_can_extract_shape(live_server, page, tilelayer):
261
261
  map.click(position={"x": 200, "y": 200})
262
262
  # Click again to finish
263
263
  map.click(position={"x": 200, "y": 200})
264
+ # Let the panel fully open, not to close the contextmenu (when
265
+ # refocus on panel input)
266
+ page.wait_for_timeout(300)
264
267
  expect(lines).to_have_count(1)
265
268
  lines.first.click(position={"x": 10, "y": 1}, button="right")
266
269
  extract_button.click()
@@ -279,6 +282,9 @@ def test_can_clone_polyline(live_server, page, tilelayer, settings):
279
282
  map.click(position={"x": 100, "y": 200})
280
283
  # Click again to finish
281
284
  map.click(position={"x": 100, "y": 200})
285
+ # Let the panel fully open, not to close the contextmenu (when
286
+ # refocus on panel input)
287
+ page.wait_for_timeout(300)
282
288
  expect(lines).to_have_count(1)
283
289
  lines.first.click(position={"x": 10, "y": 1}, button="right")
284
290
  page.get_by_role("button", name="Clone this feature").click()
@@ -304,6 +310,8 @@ def test_can_transform_polyline_to_polygon(live_server, page, tilelayer, setting
304
310
  map.click(position={"x": 100, "y": 200})
305
311
  # Click again to finish
306
312
  map.click(position={"x": 100, "y": 200})
313
+ page.wait_for_timeout(300) # Time for the panel animation to finish
314
+
307
315
  expect(paths).to_have_count(1)
308
316
  expect(polygons).to_have_count(0)
309
317
  paths.first.click(position={"x": 10, "y": 1}, button="right")
@@ -324,6 +332,9 @@ def test_can_delete_shape_using_toolbar(live_server, page, tilelayer, settings):
324
332
  map.click(position={"x": 100, "y": 100})
325
333
  map.click(position={"x": 100, "y": 200})
326
334
  map.click(position={"x": 100, "y": 200})
335
+ # Let the panel fully open, not to close the contextmenu (when
336
+ # refocus on panel input)
337
+ page.wait_for_timeout(300)
327
338
 
328
339
  # Now split the line
329
340
  map.click(position={"x": 100, "y": 100}, button="right")
@@ -15,7 +15,7 @@ def test_should_have_fieldset_for_layer_type_properties(page, live_server, tilel
15
15
  page.get_by_title("Manage layers").click()
16
16
 
17
17
  # Create a layer
18
- page.get_by_title("Add a layer").click()
18
+ page.get_by_role("button", name="Add a layer").click()
19
19
  page.locator("input[name=name]").fill("Layer 1")
20
20
 
21
21
  select = page.locator(".panel.on .umap-field-type select")
@@ -520,3 +520,22 @@ def test_can_change_field_type_with_remote_data(live_server, page, openmap, tile
520
520
  expect(page.locator(".panel .umap-filter label")).to_contain_text(
521
521
  ["bababar", "feefee", "foofoo"]
522
522
  )
523
+
524
+
525
+ def test_boolean_field_should_display_a_switch_in_feature_form(
526
+ live_server, page, openmap, tilelayer
527
+ ):
528
+ openmap.settings["properties"]["fields"] = [
529
+ {"key": "mystring", "type": "String"},
530
+ {"key": "mynumber", "type": "Number"},
531
+ {"key": "mybool", "type": "Boolean"},
532
+ ]
533
+ openmap.save()
534
+ page.goto(f"{live_server.url}{openmap.get_absolute_url()}?edit")
535
+ page.get_by_role("button", name="Draw a marker (Ctrl+M)").click()
536
+ page.locator("#map").click()
537
+ panel = page.locator(".panel")
538
+ expect(panel.locator(".umap-field-mynumber input")).to_have_attribute(
539
+ "type", "number"
540
+ )
541
+ expect(panel.locator(".umap-field-mybool.with-switch")).to_be_visible()
@@ -6,7 +6,7 @@ def test_home_control_is_hidden(live_server, map, tilelayer, page):
6
6
  <html>
7
7
  <head></head>
8
8
  <body>
9
- <iframe width="100%" height="300px" frameborder="0" allowfullscreen allow="geolocation"
9
+ <iframe style="width: 100%; height: 300px; border: 0;" allowfullscreen allow="geolocation"
10
10
  src="{map.get_absolute_url()}?scaleControl=false&miniMap=false&scrollWheelZoom=false&zoomControl=true&editMode=disabled&moreControl=true&searchControl=null&tilelayersControl=null&embedControl=null&datalayersControl=true&onLoadPanel=caption&captionBar=false&captionMenus=true"></iframe>
11
11
  </body>
12
12
  </html>