parent
9eea9f942d
commit
882cc74bcf
3 changed files with 111 additions and 0 deletions
|
@ -1114,6 +1114,7 @@ L.U.DataLayer = L.Evented.extend({
|
|||
},
|
||||
|
||||
redraw: function () {
|
||||
if (!this.isVisible()) return
|
||||
this.hide()
|
||||
this.show()
|
||||
},
|
||||
|
|
85
umap/tests/fixtures/display_on_load.umap
vendored
Normal file
85
umap/tests/fixtures/display_on_load.umap
vendored
Normal file
|
@ -0,0 +1,85 @@
|
|||
{
|
||||
"type": "umap",
|
||||
"uri": "http://localhost:8020/fr/map/carte-sans-nom_128#6/50.233/6.910",
|
||||
"properties": {
|
||||
"easing": false,
|
||||
"embedControl": true,
|
||||
"fullscreenControl": true,
|
||||
"searchControl": true,
|
||||
"datalayersControl": true,
|
||||
"zoomControl": true,
|
||||
"permanentCreditBackground": true,
|
||||
"slideshow": {},
|
||||
"captionMenus": true,
|
||||
"captionBar": false,
|
||||
"limitBounds": {},
|
||||
"overlay": null,
|
||||
"licence": "",
|
||||
"description": "",
|
||||
"name": "Carte sans nom",
|
||||
"displayPopupFooter": false,
|
||||
"miniMap": false,
|
||||
"moreControl": true,
|
||||
"scaleControl": true,
|
||||
"scrollWheelZoom": true,
|
||||
"zoom": 6
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [
|
||||
6.734619140625,
|
||||
50.359480346298696
|
||||
]
|
||||
},
|
||||
"layers": [
|
||||
{
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [
|
||||
5.141602,
|
||||
50.889174
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"_umap_options": {
|
||||
"displayOnLoad": true,
|
||||
"inCaption": true,
|
||||
"browsable": true,
|
||||
"editMode": "advanced",
|
||||
"name": "Visible",
|
||||
"remoteData": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [
|
||||
5.383301,
|
||||
49.809632
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"_umap_options": {
|
||||
"displayOnLoad": false,
|
||||
"inCaption": true,
|
||||
"browsable": true,
|
||||
"editMode": "advanced",
|
||||
"remoteData": {},
|
||||
"name": "Invisible",
|
||||
"color": "DarkRed"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
25
umap/tests/integration/test_import.py
Normal file
25
umap/tests/integration/test_import.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from playwright.sync_api import expect
|
||||
|
||||
pytestmark = pytest.mark.django_db
|
||||
|
||||
|
||||
def test_umap_import(live_server, datalayer, page):
|
||||
page.goto(f"{live_server.url}/map/new/")
|
||||
button = page.get_by_title("Import data (Ctrl+I)")
|
||||
expect(button).to_be_visible()
|
||||
button.click()
|
||||
with page.expect_file_chooser() as fc_info:
|
||||
page.locator("input[type='file']").click()
|
||||
file_chooser = fc_info.value
|
||||
path = Path(__file__).parent.parent / "fixtures/display_on_load.umap"
|
||||
file_chooser.set_files(path)
|
||||
button = page.get_by_role("button", name="Import")
|
||||
expect(button).to_be_visible()
|
||||
button.click()
|
||||
layers = page.locator(".umap-browse-datalayers li")
|
||||
expect(layers).to_have_count(3)
|
||||
nonloaded = page.locator(".umap-browse-datalayers li.off")
|
||||
expect(nonloaded).to_have_count(1)
|
Loading…
Reference in a new issue