From b197e067e82eab00ea8d7e12f5939c9fea3fc0c5 Mon Sep 17 00:00:00 2001 From: David Larlet Date: Wed, 12 Jun 2024 19:06:28 -0400 Subject: [PATCH] fix: listen to the correct event for conflicts --- umap/static/umap/js/umap.layer.js | 2 +- umap/tests/integration/test_optimistic_merge.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/umap/static/umap/js/umap.layer.js b/umap/static/umap/js/umap.layer.js index 3982c4a8..faf2d5d4 100644 --- a/umap/static/umap/js/umap.layer.js +++ b/umap/static/umap/js/umap.layer.js @@ -1713,7 +1713,7 @@ U.DataLayer = L.Evented.extend({ 'This situation is tricky, you have to choose carefully which version is pertinent.' ) ) - document.addEventListener('alertConflictOverride', async (event) => { + document.addEventListener('umap:alertConflictOverride', async (event) => { await this._trySave(url, {}, formData) }) } diff --git a/umap/tests/integration/test_optimistic_merge.py b/umap/tests/integration/test_optimistic_merge.py index ee7a1e6a..6fad8653 100644 --- a/umap/tests/integration/test_optimistic_merge.py +++ b/umap/tests/integration/test_optimistic_merge.py @@ -288,9 +288,9 @@ def test_should_display_alert_on_conflict(context, live_server, datalayer, openm saved = DataLayer.objects.last() data = json.loads(Path(saved.geojson.path).read_text()) assert data["features"][0]["properties"]["name"] == "new name" - expect(page_two.get_by_text("Woops! Someone else seems to")).to_be_visible() + expect(page_two.get_by_text("Whoops! Other contributor(s) changed")).to_be_visible() with page_two.expect_response(re.compile(r".*/datalayer/update/.*")): - page_two.get_by_role("button", name="Save anyway").click() + page_two.get_by_text("Keep your changes and loose theirs").click() saved = DataLayer.objects.last() data = json.loads(Path(saved.geojson.path).read_text()) assert data["features"][0]["properties"]["name"] == "custom name"