UNPKG

@tomino/dynamic-form-semantic-ui

Version:

Semantic UI form renderer based on dynamic form generation

64 lines 1.78 kB
import { create } from './form_query_data'; import { prepareComponent, testStandard, testEditor } from './common'; const schema = { type: 'object', properties: { agree: { type: 'boolean' }, disagree: { type: 'boolean' }, must: { type: 'boolean', errorMessage: 'You must agree to terms and conditions' } }, required: ['must'] }; const data = { agree: true, disagree: false }; const formDefinition = create.stack({ elements: [ { props: { text: 'Agree With Terms and Conditions', value: { source: 'agree' } }, control: 'Checkbox' }, { control: 'Checkbox', props: { text: 'Disagree With Terms and Conditions', toggle: true, value: { source: 'disagree' } } }, { control: 'Checkbox', props: { text: 'Disagree With Terms and Conditions', slider: true, value: { source: 'disagree' } } }, { props: { text: 'Must Agree With Terms and Conditions', value: { source: 'must' } }, control: 'Checkbox' } ] }); describe('Checkbox', () => { it('renders standard', () => { testStandard(formDefinition, schema, data); }); it('renders editor', () => { testEditor(formDefinition, schema, data); }); return { component: prepareComponent(formDefinition, schema, data, { addEditor: true, showToolBox: false, showStandard: false, validate: true }) }; }); //# sourceMappingURL=checkbox_view.test.js.map