Repository URL to install this package:
|
Version:
3.1.2 ▾
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("./_setup");
const React = require("react");
const ReactTestRenderer = require("react-test-renderer");
const PluginsContext_1 = require("../new-forms/plugins/PluginsContext");
const OneForm_1 = require("../new-forms/OneForm/OneForm");
const TextPlugin_1 = require("../new-forms/plugins/TextPlugin");
const FieldSetPlugin_1 = require("../new-forms/plugins/FieldSetPlugin");
const NamePlugin_1 = require("../new-forms/plugins/NamePlugin");
/**
* @todo probably could check the rendered dom and see if it rendered the plugin
* ^ can snapshot compare diff between using the plugin & not
*/
describe('@skava/forms - fieldset', () => {
it('fieldset works', () => {
const inputsListForFieldSet = [
{
type: 'lastName',
},
{
identity: 'billingAddress',
type: 'groupElements',
elementList: [
{
type: 'label',
value: 'billing address',
},
{
type: 'text',
labelText: 'area code',
},
],
},
{
identity: 'shippingAddress',
type: 'groupElements',
elementList: [
{
type: 'label',
value: 'shipping address',
},
{
type: 'firstName',
},
{
type: 'lastName',
},
],
},
];
const formState = new OneForm_1.OneFormState().setInputsList(inputsListForFieldSet);
const view = (React.createElement(PluginsContext_1.PluginsContext.Provider, { value: [FieldSetPlugin_1.FieldSetPlugin, NamePlugin_1.NamePlugin, TextPlugin_1.TextBoxPlugin] },
React.createElement(OneForm_1.OneObserverForm, { state: formState })));
const renderer = ReactTestRenderer.create(view);
expect(renderer.toJSON()).toMatchSnapshot();
});
});
//# sourceMappingURL=fieldset.test.js.map