fields: fix default_value for title & subtitle display locations (#76557) #256
|
@ -1906,6 +1906,29 @@ def test_form_edit_field_advanced(pub):
|
|||
assert "Are you sure you want to prefill" not in resp.text
|
||||
|
||||
|
||||
def test_form_edit_field_display(pub):
|
||||
create_superuser(pub)
|
||||
create_role(pub)
|
||||
|
||||
FormDef.wipe()
|
||||
formdef = FormDef()
|
||||
formdef.name = 'form title'
|
||||
formdef.fields = [
|
||||
fields.TitleField(id='1', label='Title', type='title'),
|
||||
fields.SubtitleField(id='2', label='Subtitle', type='subtitle'),
|
||||
fields.StringField(id='3', label='1st field', type='string'),
|
||||
]
|
||||
formdef.store()
|
||||
|
||||
app = login(get_app(pub))
|
||||
resp = app.get('/backoffice/forms/1/fields/1/')
|
||||
assert not resp.pyquery('#tab-display.pk-tabs--button-marker')
|
||||
resp = app.get('/backoffice/forms/1/fields/2/')
|
||||
assert not resp.pyquery('#tab-display.pk-tabs--button-marker')
|
||||
resp = app.get('/backoffice/forms/1/fields/3/')
|
||||
assert not resp.pyquery('#tab-display.pk-tabs--button-marker')
|
||||
|
||||
|
||||
def test_form_prefill_field(pub):
|
||||
create_superuser(pub)
|
||||
create_role(pub)
|
||||
|
|
|
@ -1141,6 +1141,7 @@ class TitleField(Field):
|
|||
title=_('Display Locations'),
|
||||
options=self.get_display_locations_options(),
|
||||
value=self.display_locations,
|
||||
default_value=self.__class__.display_locations,
|
||||
|
||||
tab=('display', _('Display')),
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
On pourrait tenter un générique « default_value=self.class.display_locations » comme un peu plus haut sur WidgetField ?