Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/forms / build / dist / __tests__ / lifecycle.test.js
Size: Mime:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("./_setup");
const React = require("react");
const react_testing_library_1 = require("react-testing-library");
const OneForm_1 = require("..//new-forms/OneForm/OneForm");
const PluginsContext_1 = require("../new-forms/plugins/PluginsContext");
const TextPlugin_1 = require("../new-forms/plugins/TextPlugin");
/**
 * @todo check all forms for functionality used...
 */
function toTest() {
    const formState = new OneForm_1.OneFormState().setInputsList([
        {
            identifier: '0',
            value: 'testing',
            type: 'text',
        },
    ]);
    const handlePreFill = (inputState) => {
        inputState.setIdentifier('100x');
    };
    const view = (React.createElement(PluginsContext_1.PluginsContext.Provider, { value: [TextPlugin_1.TextBoxPlugin] },
        React.createElement(OneForm_1.OneObserverForm, { state: formState, onPreFill: handlePreFill })));
    return {
        view,
    };
}
describe('@skava/forms - lifecycle', () => {
    afterEach(react_testing_library_1.cleanup);
    it('should prefil', () => {
        const { view } = toTest();
        const { container } = react_testing_library_1.render(view);
        const found = container.querySelector('input');
        const id = found.getAttribute('id');
        expect(id).toEqual('100x');
    });
});
//# sourceMappingURL=lifecycle.test.js.map