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:
@@ -16,9 +16,9 @@ function field(type: string, name = 'title'): FormField {
|
||||
|
||||
const enabledLocales = ref<readonly string[]>(['en', 'pl'])
|
||||
|
||||
function mlMount(component: typeof MLTextField | typeof MLMarkdownField, props: Record<string, unknown>) {
|
||||
function mlMount(component: typeof MLTextField | typeof MLMarkdownField, props: object) {
|
||||
return mount(component, {
|
||||
props,
|
||||
props: props as never,
|
||||
attachTo: document.body,
|
||||
global: {
|
||||
provide: {
|
||||
@@ -135,4 +135,33 @@ describe('ML field registry and nested save body', () => {
|
||||
await wrapper.find('input').setValue('Witaj')
|
||||
expect(wrapper.emitted('update:modelValue')?.at(-1)).toEqual([{ en: 'Hello', pl: 'Witaj' }])
|
||||
})
|
||||
|
||||
it('seeds empty maps and lists every enabled locale on mlmarkdown create', () => {
|
||||
const fields = [field('mlmarkdown', 'body')]
|
||||
const values = initialValues(fields, ['en', 'pl'])
|
||||
expect(values.body).toEqual({ en: '', pl: '' })
|
||||
const wrapper = mlMount(MLMarkdownField, {
|
||||
field: fields[0],
|
||||
modelValue: values.body,
|
||||
controlId: 'f-body',
|
||||
})
|
||||
expect(wrapper.findComponent(MarkdownField).exists()).toBe(true)
|
||||
expect(wrapper.findAll('[data-ml-locale] option').map((node) => node.text())).toEqual(['en', 'pl'])
|
||||
})
|
||||
|
||||
it('keeps sibling locales when adopt merges a GET host string on mlmarkdown', async () => {
|
||||
const fields = [field('mlmarkdown', 'body')]
|
||||
const merged = mergeMLValue('# Hello', ['en', 'pl'])
|
||||
expect(merged).toEqual({ en: '# Hello', pl: '' })
|
||||
const wrapper = mlMount(MLMarkdownField, {
|
||||
field: fields[0],
|
||||
modelValue: merged,
|
||||
controlId: 'f-body',
|
||||
})
|
||||
expect(wrapper.findComponent(MarkdownField).exists()).toBe(true)
|
||||
expect(wrapper.findAll('[data-ml-locale] option').map((node) => node.text())).toEqual(['en', 'pl'])
|
||||
await wrapper.find('[data-ml-locale]').setValue('pl')
|
||||
await wrapper.find('textarea').setValue('# Witaj')
|
||||
expect(wrapper.emitted('update:modelValue')?.at(-1)).toEqual([{ en: '# Hello', pl: '# Witaj' }])
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user