mirror of
https://github.com/umap-project/umap.git
synced 2025-05-11 00:21:49 +02:00
Compare commits
No commits in common. "05c27aed98ca0ff5cfe33c1974944a50d795955e" and "06c2438ff18bb0e09eb0c504167ea2afb03e9f73" have entirely different histories.
05c27aed98
...
06c2438ff1
3 changed files with 7 additions and 43 deletions
|
@ -526,13 +526,15 @@ export class DataLayer extends ServerStored {
|
||||||
}
|
}
|
||||||
|
|
||||||
async importFromFiles(files, type) {
|
async importFromFiles(files, type) {
|
||||||
const toLoad = []
|
let all = []
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
toLoad.push(this.importFromFile(file, type))
|
const features = await this.importFromFile(file, type)
|
||||||
|
if (features) {
|
||||||
|
all = all.concat(features)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const features = await Promise.all(toLoad)
|
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
resolve([].concat(...features))
|
resolve(all)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
{
|
|
||||||
"crs": null,
|
|
||||||
"type": "FeatureCollection",
|
|
||||||
"features": [
|
|
||||||
{
|
|
||||||
"type": "Feature",
|
|
||||||
"geometry": {
|
|
||||||
"coordinates": [
|
|
||||||
-1.09314,
|
|
||||||
50.791718
|
|
||||||
],
|
|
||||||
"type": "Point"
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"name": "Portsmouth"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -9,6 +9,7 @@ from playwright.sync_api import expect
|
||||||
|
|
||||||
from umap.models import DataLayer
|
from umap.models import DataLayer
|
||||||
|
|
||||||
|
from ..base import mock_tiles
|
||||||
from .helpers import save_and_get_json
|
from .helpers import save_and_get_json
|
||||||
|
|
||||||
pytestmark = pytest.mark.django_db
|
pytestmark = pytest.mark.django_db
|
||||||
|
@ -764,23 +765,3 @@ def test_import_georss_from_textarea(tilelayer, live_server, page):
|
||||||
# A layer has been created
|
# A layer has been created
|
||||||
expect(layers).to_have_count(1)
|
expect(layers).to_have_count(1)
|
||||||
expect(markers).to_have_count(1)
|
expect(markers).to_have_count(1)
|
||||||
|
|
||||||
|
|
||||||
def test_import_from_multiple_files(live_server, page, tilelayer):
|
|
||||||
page.goto(f"{live_server.url}/map/new/")
|
|
||||||
page.get_by_title("Import data").click()
|
|
||||||
file_input = page.locator("input[type='file']")
|
|
||||||
with page.expect_file_chooser() as fc_info:
|
|
||||||
file_input.click()
|
|
||||||
file_chooser = fc_info.value
|
|
||||||
FIXTURES = Path(__file__).parent.parent / "fixtures"
|
|
||||||
paths = [
|
|
||||||
FIXTURES / "test_upload_data.json",
|
|
||||||
FIXTURES / "test_upload_simple_marker.json",
|
|
||||||
]
|
|
||||||
file_chooser.set_files(paths)
|
|
||||||
markers = page.locator(".leaflet-marker-icon")
|
|
||||||
expect(markers).to_have_count(0)
|
|
||||||
page.get_by_role("button", name="Import data", exact=True).click()
|
|
||||||
# Two in one file, one in the other
|
|
||||||
expect(markers).to_have_count(3)
|
|
||||||
|
|
Loading…
Reference in a new issue