feat(admin): render mltextarea fields per locale

- MLField.vue is the one locale-switching wrapper; MLTextField,
  MLMarkdownField and the new MLTextareaField are shells around it
- isMLFieldType replaces the inline ML type-name checks in formState,
  FormView and RelationChildModal
- register mltextarea as a group-labelled control; rebuild dist
This commit is contained in:
Jakub Zych
2026-10-06 21:36:04 +02:00
parent 3596df4ff5
commit a913eec50f
15 changed files with 275 additions and 162 deletions

View File

@@ -630,4 +630,27 @@ describe('password and preset on the form (UI-SPEC S7, D-19, D-27 G7)', () => {
await localeSelect(wrapper, 'slug').setValue('pl')
expect(editor(wrapper, 'slug').element.value).toBe('')
})
it('edits an mltextarea field per locale and saves the nested map', async () => {
const schema = mlSchema('mltextarea', 'text')
for (const item of schema.body.data.fields) {
if (item.name === 'name') {
item.size = 'small'
}
}
const record = clone(rosterRecordFixture)
record.data.name = { en: 'Ada\nLovelace', pl: '' }
const { wrapper, calls } = await mountApp(
'/acme/roster/people/1',
people({ [`GET ${PEOPLE}/schema/form`]: schema, [`GET ${PERSON}`]: { body: record }, [`PUT ${PERSON}`]: { body: rosterRecordFixture } }),
)
const textarea = wrapper.find<HTMLTextAreaElement>('#field-name-editor')
expect(textarea.element.tagName).toBe('TEXTAREA')
expect(textarea.element.value).toBe('Ada\nLovelace')
await localeSelect(wrapper, 'name').setValue('pl')
await wrapper.find<HTMLTextAreaElement>('#field-name-editor').setValue('Ada po polsku')
await save(wrapper)
const body = (await requestsTo(calls, 'PUT', PERSON)[0]!.clone().json()) as Record<string, unknown>
expect(body.name).toEqual({ en: 'Ada\nLovelace', pl: 'Ada po polsku' })
})
})