fix: listen to the correct event for conflicts

This commit is contained in:
David Larlet 2024-06-12 19:06:28 -04:00
parent 8400b55b9d
commit b197e067e8
No known key found for this signature in database
GPG key ID: 3E2953A359E7E7BD
2 changed files with 3 additions and 3 deletions

View file

@ -1713,7 +1713,7 @@ U.DataLayer = L.Evented.extend({
'This situation is tricky, you have to choose carefully which version is pertinent.' '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) await this._trySave(url, {}, formData)
}) })
} }

View file

@ -288,9 +288,9 @@ def test_should_display_alert_on_conflict(context, live_server, datalayer, openm
saved = DataLayer.objects.last() saved = DataLayer.objects.last()
data = json.loads(Path(saved.geojson.path).read_text()) data = json.loads(Path(saved.geojson.path).read_text())
assert data["features"][0]["properties"]["name"] == "new name" 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/.*")): 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() saved = DataLayer.objects.last()
data = json.loads(Path(saved.geojson.path).read_text()) data = json.loads(Path(saved.geojson.path).read_text())
assert data["features"][0]["properties"]["name"] == "custom name" assert data["features"][0]["properties"]["name"] == "custom name"