This commit is contained in:
Yohan Boniface 2025-02-10 17:20:13 +01:00 committed by GitHub
commit fd70904feb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 17 additions and 6 deletions

View file

@ -142,13 +142,14 @@ export class MutatingForm extends Form {
slugKey: 'PropertyInput', slugKey: 'PropertyInput',
labelKey: 'PropertyInput', labelKey: 'PropertyInput',
} }
for (const [key, schema] of Object.entries(SCHEMA)) { for (const [key, definition] of Object.entries(SCHEMA)) {
if (schema.type === Boolean) { const schema = Utils.CopyJSON(definition)
if (definition.type === Boolean) {
if (schema.nullable) schema.handler = 'NullableChoices' if (schema.nullable) schema.handler = 'NullableChoices'
else schema.handler = 'Switch' else schema.handler = 'Switch'
} else if (schema.type === 'Text') { } else if (definition.type === 'Text') {
schema.handler = 'Textarea' schema.handler = 'Textarea'
} else if (schema.type === Number) { } else if (definition.type === Number) {
if (schema.step) schema.handler = 'Range' if (schema.step) schema.handler = 'Range'
else schema.handler = 'IntInput' else schema.handler = 'IntInput'
} else if (schema.choices) { } else if (schema.choices) {

View file

@ -1195,7 +1195,7 @@ Fields.NullableChoices = class extends Fields.TernaryChoices {
this.properties.choices || [ this.properties.choices || [
[true, translate('always')], [true, translate('always')],
[false, translate('never')], [false, translate('never')],
['null', translate('hidden')], [null, translate('hidden')],
] ]
) )
} }

View file

@ -450,7 +450,7 @@ export const SCHEMA = {
choices: [ choices: [
[true, translate('always')], [true, translate('always')],
[false, translate('never')], [false, translate('never')],
['null', translate('on hover')], [null, translate('on hover')],
], ],
}, },
slideshow: { slideshow: {

View file

@ -181,3 +181,13 @@ def test_only_visible_markers_are_added_to_dom(live_server, map, page):
) )
expect(markers).to_have_count(1) expect(markers).to_have_count(1)
expect(tooltips).to_have_count(1) expect(tooltips).to_have_count(1)
def test_should_display_tooltip_on_hover(live_server, map, page, bootstrap):
map.settings["properties"]["showLabel"] = None
map.settings["properties"]["labelKey"] = "Foo {name}"
map.save()
page.goto(f"{live_server.url}{map.get_absolute_url()}")
expect(page.get_by_text("Foo test marker")).to_be_hidden()
page.locator(".leaflet-marker-icon").hover()
expect(page.get_by_text("Foo test marker")).to_be_visible()