feat(14.2.1-05): cover mlmarkdown, child adopt, and regen admin artifacts

MLMarkdownField and relation-child forms share the enabled-locale
inject and adopt merge; OpenAPI, types, docs, and boardwalk dist match.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jakub Zych
2026-10-06 15:41:46 +02:00
parent 0f8d13738d
commit 424fe9ccc0
14 changed files with 104 additions and 28 deletions

View File

@@ -6,6 +6,7 @@ import {
fieldErrors,
focusField,
initialValues,
mergeMLValue,
panelDomId,
presetValue,
snapshot,
@@ -55,7 +56,7 @@ describe('form state helpers', () => {
const fields = [formField('name'), ...extensionFormSchemaFixture.data.fields.filter((field) => field.type === 'widget' || field.type === 'partial')]
expect(fields.map((field) => field.type)).toEqual(['text', 'widget', 'partial'])
expect(editablePayload(fields, { name: 'Blue', lookup: 'x', summary: { nodes: [] } })).toEqual({ name: 'Blue' })
expect(initialValues(fields.slice(1))).toEqual({})
expect(initialValues(fields.slice(1), [])).toEqual({})
})
it('starts a new record from defaults, toggles off and empty multiple relations', () => {
@@ -67,7 +68,7 @@ describe('form state helpers', () => {
formField('maker'),
{ ...formField('weight'), default: 0 },
]
expect(initialValues(fields)).toEqual({ name: 'Unnamed', active: false, featured: false, tags: [], weight: 0 })
expect(initialValues(fields, [])).toEqual({ name: 'Unnamed', active: false, featured: false, tags: [], weight: 0 })
})
it('normalizes 422 details into string lists and drops empty entries', () => {
@@ -119,7 +120,7 @@ describe('password and permission values in the save body (UI-SPEC S5 and S7)',
})
it('starts password fields empty, whatever the record holds', () => {
const initial = initialValues(fields.filter((field) => field.type === 'password'))
const initial = initialValues(fields.filter((field) => field.type === 'password'), [])
expect(initial.password ?? '').toBe('')
expect(initial.password_confirmation ?? '').toBe('')
})
@@ -178,3 +179,22 @@ describe('preset values (D-27 G7)', () => {
}
})
})
describe('ML create seed and adopt merge', () => {
it('seeds every enabled locale as an empty string', () => {
const fields = [
{ name: 'title', type: 'mltext', label: 'Title' } as ReturnType<typeof formField>,
{ name: 'body', type: 'mlmarkdown', label: 'Body' } as ReturnType<typeof formField>,
]
expect(initialValues(fields, ['en', 'pl'])).toEqual({
title: { en: '', pl: '' },
body: { en: '', pl: '' },
})
expect(initialValues(fields, [])).toEqual({ title: {}, body: {} })
})
it('merges a GET host string onto the seed without dropping sibling locales', () => {
expect(mergeMLValue('Hello', ['en', 'pl'])).toEqual({ en: 'Hello', pl: '' })
expect(mergeMLValue({ en: 'Hello', pl: 'Witaj' }, ['en', 'pl'])).toEqual({ en: 'Hello', pl: 'Witaj' })
})
})