test(19.6.1-03): SPA trigger, record lock and footer wrap tests

- trigger.test.ts: triggerState and applyTriggers
- FormView: disable, absent-controller and hide-tab backstops, the live
  announcement
- PermissionEditorField and formState: record-locked rows, notes and the
  payload omission, record lock over request lock, read-only screens
- PreviewView: hide removes, disable shows no note
- browser record-actions-wrap at 1024px; vitest.browser.config.ts gains
  the Tailwind plugin so the footer is laid out with the admin's CSS
This commit is contained in:
Jakub Zych
2026-10-22 12:18:34 +02:00
parent 085179b676
commit 4c61a180d0
7 changed files with 555 additions and 3 deletions

View File

@@ -343,3 +343,43 @@ describe('preview edit rule (UI-SPEC F6)', () => {
expect(wrapper.find('[data-action="edit"]').exists()).toBe(false)
})
})
describe('field triggers on the preview (D-21, UI-SPEC C6)', () => {
type Field = (typeof rosterFormSchemaFixture.data.fields)[number]
const vip: Field = { name: 'vip', type: 'switch', label: 'VIP' }
function triggeredSchema() {
return schemaWith((schema) => {
for (const field of schema.fields) {
if (field.name === 'slug') {
field.trigger = { action: 'hide', field: 'vip', condition: 'checked' }
}
if (field.name === 'email') {
field.trigger = { action: 'disable', field: 'vip', condition: 'checked' }
}
}
schema.fields.unshift(vip)
})
}
it('a hide trigger removes the field while it holds; a disable trigger shows the value without a note', async () => {
const { wrapper } = await mountApp(
PREVIEW,
routes({ [`GET ${LIST}/schema/form`]: triggeredSchema(), [`GET ${RECORD}`]: recordWith((record) => Object.assign(record.data, { vip: true })) }),
)
expect(fields(wrapper)).not.toContain('slug')
expect(fields(wrapper)).toContain('email')
expect(wrapper.find('[data-preview-field="email"]').text()).toContain('ada@example.test')
expect(wrapper.find('[data-trigger-note]').exists()).toBe(false)
})
it('shows the field again while the trigger does not hold', async () => {
const { wrapper } = await mountApp(
PREVIEW,
routes({ [`GET ${LIST}/schema/form`]: triggeredSchema(), [`GET ${RECORD}`]: recordWith((record) => Object.assign(record.data, { vip: false })) }),
)
expect(fields(wrapper)).toContain('slug')
expect(fields(wrapper)).toContain('email')
expect(wrapper.find('[data-trigger-note]').exists()).toBe(false)
})
})