test(10.1-04): bring the SPA extension point under Vitest

- WidgetField: skeleton and aria-busy, the 5000 ms whenDefined timeout,
  script failure, attributes only, fill-values and locale sync, one POST
  while busy, fill-key-only patching, danger toasts, unmount
- PartialHost and partialNodes: exhaustive tag, attribute and URL
  allowlist, depth and node caps, skeleton sizes, empty, failure,
  busy refetch and ?id= only with a record
- PartialField, ListToolbar, ListView, registry, formState, FormField and
  FormView: group labels, registered toolbar actions, header refetch
  rules, form context provision and asset loading
This commit is contained in:
Jakub Zych
2026-09-29 02:59:13 +02:00
parent 6b0ac15086
commit 11c4e5466b
9 changed files with 1194 additions and 9 deletions

View File

@@ -11,7 +11,7 @@ import {
tabDomId,
tabOf,
} from '../../src/components/form/formState'
import { formField, formSchemaFixture } from '../fixtures/typed'
import { extensionFormSchemaFixture, formField, formSchemaFixture } from '../fixtures/typed'
afterEach(() => {
document.body.innerHTML = ''
@@ -50,6 +50,13 @@ describe('form state helpers', () => {
expect(body).toEqual({ name: 'Blue', tags: [3], active: false })
})
it('never sends widget or partial fields, even with a value under their name', () => {
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({})
})
it('starts a new record from defaults, toggles off and empty multiple relations', () => {
const fields = [
{ ...formField('name'), default: 'Unnamed' },