UNPKG

@formio/react

Version:

React renderer for form.io forms.

44 lines (43 loc) 1.39 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const jsx_runtime_1 = require("react/jsx-runtime"); const react_1 = require("@testing-library/react"); const dom_1 = require("@testing-library/dom"); require("@testing-library/jest-dom"); const Form_1 = require("../Form"); const simpleForm = { display: 'form', components: [ { label: 'First Name', key: 'firstName', type: 'textfield', input: true, }, { label: 'Last Name', key: 'lastName', type: 'textfield', input: true, validate: { required: true, }, }, { label: 'Submit', type: 'button', key: 'submit', input: true, disableOnInvalid: true, }, ], }; test('loads and displays a simple form', async () => { const executeTests = async () => { expect(dom_1.screen.getByText('First Name')).toBeInTheDocument(); expect(dom_1.screen.getByText('Last Name')).toBeInTheDocument(); expect(dom_1.screen.getByText('Submit')).toBeInTheDocument(); expect(await dom_1.screen.findByRole('button')).toBeDisabled(); }; (0, react_1.render)((0, jsx_runtime_1.jsx)(Form_1.Form, { src: simpleForm, onFormReady: executeTests })); });