@tomino/dynamic-form-semantic-ui
Version:
Semantic UI form renderer based on dynamic form generation
74 lines • 2.06 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const form_query_data_1 = require("./form_query_data");
const common_1 = require("./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 = form_query_data_1.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', () => {
common_1.testStandard(formDefinition, schema, controlData);
});
it('renders editor', () => {
common_1.testEditor(formDefinition, schema, controlData);
});
return {
component: common_1.prepareComponent(formDefinition, schema, controlData, { addEditor: true })
};
});
//# sourceMappingURL=table_view.test.js.map