UNPKG

@tomino/dynamic-form-semantic-ui

Version:

Semantic UI form renderer based on dynamic form generation

72 lines 1.96 kB
import { create } from './form_query_data'; import { prepareComponent, testStandard, testEditor } from './common'; const schema = { type: 'object', properties: { countries: { type: 'array', items: { type: 'object', properties: { id: { type: 'string' }, name: { type: 'string' }, capital: { type: 'string' } }, required: ['name'] } } } }; const controlData = { countries: [ { name: 'Slovakia', capital: 'Bratislava' }, { name: 'Australia', capital: 'Canberra' } ] }; const formDefinition = create.stack({ props: { final: true }, elements: [ { props: { items: [ { title: 'Name', source: 'name', type: 'string' }, { title: 'Capital', source: 'capital', type: 'string' } ], allowDelete: true, allowEdit: true, allowAdd: true, value: { source: 'countries' } }, control: 'Table', elements: [ { elements: [] }, { elements: [] }, { elements: [] } ] } ] }); describe('Table', () => { it('renders standard', () => { testStandard(formDefinition, schema, controlData); }); it('renders editor', () => { testEditor(formDefinition, schema, controlData); }); return { component: prepareComponent(formDefinition, schema, controlData, { addEditor: true }) }; }); //# sourceMappingURL=table_view.test.js.map