@tomino/dynamic-form-semantic-ui
Version:
Semantic UI form renderer based on dynamic form generation
66 lines • 1.88 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: {
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 = form_query_data_1.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', () => {
common_1.testStandard(formDefinition, schema, data);
});
it('renders editor', () => {
common_1.testEditor(formDefinition, schema, data);
});
return {
component: common_1.prepareComponent(formDefinition, schema, data, {
addEditor: true,
showToolBox: false,
showStandard: false,
validate: true
})
};
});
//# sourceMappingURL=checkbox_view.test.js.map