feat(16.2-01): translatable plugin fields, element uploads and save notices in the admin
- MLPluginField wraps PluginField in the MLField locale switcher; the
element gets the active content locale and that locale's string
- isMLField treats a translatable plugin field as a locale map in the form
state, FormView adopt and the relation child modal
- summer-upload posts the file with the admin session to the field upload
route and answers summer-upload-result {id, url} or {id, error}
- noticeLines shows meta.notices under each field as a warning status line
(text only) and in the saved toast; the stored value is reloaded
- docs/backend/field-types.md documents the full element contract;
modules/boardwalk/dist rebuilt
This commit is contained in:
@@ -10,6 +10,28 @@ beforeEach(() => {
|
||||
resetState()
|
||||
})
|
||||
|
||||
describe('save notices', () => {
|
||||
it('shows notices as a warning status line the control points at', () => {
|
||||
const wrapper = mount(FormField, {
|
||||
props: { field: formField('code'), modelValue: '', notices: ['PL: <style> was removed', 'Second'], idPrefix: 'f' },
|
||||
})
|
||||
const line = wrapper.find('#f-code-notice')
|
||||
expect(line.attributes('role')).toBe('status')
|
||||
expect(line.classes()).toEqual(expect.arrayContaining(['summer-callout', 'summer-callout--warning']))
|
||||
expect(line.findAll('p').map((p) => p.text())).toEqual(['PL: <style> was removed', 'Second'])
|
||||
// Literal text: an HTML-looking message never becomes an element.
|
||||
expect(line.find('style').exists()).toBe(false)
|
||||
expect(line.html()).toContain('<style>')
|
||||
expect(wrapper.find('#f-code').attributes('aria-describedby')).toBe('f-code-comment f-code-notice')
|
||||
})
|
||||
|
||||
it('shows nothing without notices', () => {
|
||||
const wrapper = mount(FormField, { props: { field: formField('code'), modelValue: '', notices: [], idPrefix: 'f' } })
|
||||
expect(wrapper.find('[data-field-notice]').exists()).toBe(false)
|
||||
expect(wrapper.find('#f-code').attributes('aria-describedby')).toBe('f-code-comment')
|
||||
})
|
||||
})
|
||||
|
||||
describe('form field', () => {
|
||||
it('links the label to the control and hides the required asterisk from assistive tech', () => {
|
||||
const wrapper = mount(FormField, { props: { field: formField('name'), modelValue: 'Blue', idPrefix: 'f' } })
|
||||
|
||||
Reference in New Issue
Block a user