diff --git a/umap/static/umap/js/modules/formatter.js b/umap/static/umap/js/modules/formatter.js index a4d864f8..20a0533c 100644 --- a/umap/static/umap/js/modules/formatter.js +++ b/umap/static/umap/js/modules/formatter.js @@ -106,7 +106,7 @@ export class Formatter { } async fromGeoRSS(str) { - return GeoRSSToGeoJSON(this.toDom(c)) + return GeoRSSToGeoJSON(this.toDom(str)) } toDom(x) { diff --git a/umap/tests/fixtures/test_upload_georss.xml b/umap/tests/fixtures/test_upload_georss.xml new file mode 100644 index 00000000..e67a58bc --- /dev/null +++ b/umap/tests/fixtures/test_upload_georss.xml @@ -0,0 +1,20 @@ + + + + Test stream + http://www.pouet.fr/link/ + + Sun, 13 Apr 2014 09:20:36 -0700 + Sun, 13 Apr 2014 09:20:36 -0700 + http://www.pouet.com/ + + Title 1 + http://link.com + Description 1 + Sun, 13 Apr 2014 09:20:36 -0700 + 53.443324 + -2.218337 + + + + diff --git a/umap/tests/integration/test_import.py b/umap/tests/integration/test_import.py index 43ad2f83..078490a5 100644 --- a/umap/tests/integration/test_import.py +++ b/umap/tests/integration/test_import.py @@ -607,3 +607,23 @@ def test_import_osm_relation(tilelayer, live_server, page): # A layer and one path has been created expect(layers).to_have_count(1) expect(paths).to_have_count(1) + + +def test_import_georss_from_textarea(tilelayer, live_server, page): + page.goto(f"{live_server.url}/map/new/") + page.get_by_title("Open browser").click() + layers = page.locator(".umap-browser .datalayer") + markers = page.locator(".leaflet-marker-icon") + expect(markers).to_have_count(0) + expect(layers).to_have_count(0) + button = page.get_by_title("Import data") + expect(button).to_be_visible() + button.click() + textarea = page.locator(".umap-upload textarea") + path = Path(__file__).parent.parent / "fixtures/test_upload_georss.xml" + textarea.fill(path.read_text()) + page.locator('select[name="format"]').select_option("georss") + page.get_by_role("button", name="Import data", exact=True).click() + # A layer has been created + expect(layers).to_have_count(1) + expect(markers).to_have_count(1)