@tomino/dynamic-form-semantic-ui
Version:
Semantic UI form renderer based on dynamic form generation
112 lines • 4.04 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const common_1 = require("../../semantic/tests/common");
const form_query_data_1 = require("../../semantic/tests/form_query_data");
const schema = {
type: 'object',
properties: {
fake: { type: 'string' },
people: {
type: 'array',
items: {
type: 'object',
properties: {
name: { type: 'string' },
sex: { type: 'string' }
}
}
}
}
};
const formDefinition = form_query_data_1.create.stack({
elements: [
{
control: 'ApolloProvider',
props: {
server: 'http://localhost:4000/graphql',
auth: false,
disable: true
},
elements: []
},
{
control: 'ApolloProvider',
props: {
server: 'http://localhost:4000/graphql',
auth: false
},
elements: [
{
control: 'Stack',
props: {
layout: 'column',
gap: '3px'
},
elements: [
{
control: 'ApolloQuery',
props: {
query: `query People {
people {
name
sex
},
}`,
fakeData: { source: 'fake' },
target: 'people',
loadingText: 'Loading ...'
},
elements: [
{
control: 'Repeater',
props: {
value: { source: 'people' }
},
elements: [
{
control: 'Stack',
props: { layout: 'row' },
elements: [
{
control: 'Text',
props: {
value: { source: 'name' }
}
},
{
control: 'Text',
props: { value: ':\xa0' }
},
{
control: 'Text',
props: {
value: { source: 'sex' }
}
}
]
},
null,
null
]
}
]
}
]
}
]
}
]
});
const formData = {
fake: JSON.stringify({
people: [{ name: 'Tomas', sex: 'Male' }]
})
};
describe('Apollo', () => {
describe('Query', () => {
return {
component: common_1.prepareComponent(formDefinition, schema, formData, { addEditor: true })
};
});
});
//# sourceMappingURL=apollo_view.test.js.map