UNPKG

@tomino/dynamic-form-semantic-ui

Version:

Semantic UI form renderer based on dynamic form generation

126 lines 3.33 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const form_query_data_1 = require("../../semantic/tests/form_query_data"); const common_1 = require("../../semantic/tests/common"); const schema = { type: 'object', properties: { mother: { type: 'string' }, father: { type: 'string' }, child: { type: 'string' } }, definitions: { person: { type: 'object', properties: { uid: { type: 'string' }, name: { type: 'string' } } } } }; const formDefinition = form_query_data_1.create.grid({ props: { rows: 3, columns: 4 }, elements: [ { props: { text: 'Hello ${mother}', url: 'https://www.google.com', row: 1, column: 1, width: 1 }, control: 'Link' }, { props: { row: 1, column: 2, width: 1, value: { source: 'child' } }, control: 'Text' }, { props: { row: 1, column: 3, width: 1, source: { source: 'mother' }, target: { source: 'child' }, text: 'Make Mother' }, control: 'LinkSelector' }, { props: { row: 1, column: 4, width: 1, target: { source: 'child' }, source: { source: 'father' }, text: 'Make Father' }, control: 'LinkSelector' }, { props: { row: 3, column: 1, width: 1, value: 'Yah!' }, control: 'Text' }, { props: { row: 2, column: 2, width: 2, height: 2, imageWidth: { value: '300px' }, imageHeight: { value: '40px' }, src: { value: 'https://d20xd7mbt7xiju.cloudfront.net/test/wsu/WSU_logo.jpg' } }, control: 'Image' }, { props: { row: 2, column: 1, width: 1, value: 'TOMAS' }, control: 'Text' }, { props: { row: 2, column: 4, width: 1, text: 'WSU ${father}', imageWidth: '300px', imageHeight: '40px', url: 'https://www.westernsydney.edu.au' }, control: 'Link' } ] }); const formData = { father: 'Tomas', mother: 'Valeria', child: 'Momo' }; describe('Texts', () => { it('renders standard', () => { common_1.testStandard(formDefinition, schema, formData); }); it('renders editor', () => { common_1.testEditor(formDefinition, schema, formData); }); return { component: common_1.prepareComponent(formDefinition, schema, formData, { addEditor: true, showReadOnly: false, showStandard: false, showProperties: false, showToolBox: false }) }; }); //# sourceMappingURL=texts.test.js.map