fix: open caption form when clicking on map name, not advanced props

This commit is contained in:
Yohan Boniface 2024-05-01 15:31:32 +02:00
parent 45812432fc
commit 757cc1ee6c
2 changed files with 9 additions and 8 deletions

View file

@ -754,13 +754,7 @@ const ControlsMixin = {
const rightContainer = L.DomUtil.create('div', 'umap-right-edit-toolbox', container) const rightContainer = L.DomUtil.create('div', 'umap-right-edit-toolbox', container)
const logo = L.DomUtil.create('div', 'logo', leftContainer) const logo = L.DomUtil.create('div', 'logo', leftContainer)
L.DomUtil.createLink('', logo, 'uMap', '/', null, L._('Go to the homepage')) L.DomUtil.createLink('', logo, 'uMap', '/', null, L._('Go to the homepage'))
const nameButton = L.DomUtil.createButton( const nameButton = L.DomUtil.createButton('map-name', leftContainer, '')
'map-name',
leftContainer,
'',
this.edit,
this
)
L.DomEvent.on( L.DomEvent.on(
nameButton, nameButton,
'mouseover', 'mouseover',
@ -809,7 +803,7 @@ const ControlsMixin = {
update() update()
this.once('saved', L.bind(update, this)) this.once('saved', L.bind(update, this))
if (this.options.editMode === 'advanced') { if (this.options.editMode === 'advanced') {
L.DomEvent.on(nameButton, 'click', this.edit, this) L.DomEvent.on(nameButton, 'click', this.editCaption, this)
L.DomEvent.on(shareStatusButton, 'click', this.permissions.edit, this.permissions) L.DomEvent.on(shareStatusButton, 'click', this.permissions.edit, this.permissions)
} }
this.on('postsync', L.bind(update, this)) this.on('postsync', L.bind(update, this))

View file

@ -21,6 +21,13 @@ def test_can_edit_name(page, live_server, tilelayer):
) )
def test_can_edit_name_on_click_on_toolbar(page, live_server, tilelayer):
page.goto(f"{live_server.url}/en/map/new/")
page.locator(".map-name").click()
name_input = page.locator('.map-metadata input[name="name"]')
expect(name_input).to_be_visible()
def test_map_name_impacts_ui(live_server, page, tilelayer): def test_map_name_impacts_ui(live_server, page, tilelayer):
page.goto(f"{live_server.url}/en/map/new/") page.goto(f"{live_server.url}/en/map/new/")