import * as React from "react"; import "babel-polyfill"; import { render, screen, fireEvent, cleanup } from "@testing-library/react"; import EditFormField from "./EditFormField"; import { FormFieldTypes } from "../types"; const testId = "FormBuilder-EditFormField"; const textFieldTestId = "FormBuilder-FormFields-TextField-EDITOR"; const dateFieldTestId = "FormBuilder-FormFields-DateField-EDITOR"; const dropDownTestId = "FormBuilder-FormFields-DropdownField-EDITOR"; const textAreaTestId = "FormBuilder-FormFields-TextAreaField-EDITOR"; const checkboxesTestId = "FormBuilder-FormFields-Checkboxes-EDITOR"; const multipleChoiceTestId = "FormBuilder-FormFields-MultipleChoice-EDITOR"; const contentFieldTestId = "FormBuilder-FormFields-ContentField-EDITOR"; const fileUploadTestId = "FormBuilder-FormFields-FileUpload-EDITOR"; const linearScaleTestId = "FormBuilder-FormFields-LinearScaleField-EDITOR"; const allTestIds = { TEXT: textFieldTestId, PASSWORD: textFieldTestId, CHECKBOXES: checkboxesTestId, // RADIO: multipleChoiceTestId, TEXTAREA: textAreaTestId, SELECT: dropDownTestId, DATE: dateFieldTestId, CONTENT: contentFieldTestId, NUMBER: textFieldTestId, CURRENCY: textFieldTestId, DROPDOWN: dropDownTestId, MULTIPLECHOICE: multipleChoiceTestId, TYPOGRAPHY: contentFieldTestId, FILEUPLOAD: fileUploadTestId, LINEARSCALE: linearScaleTestId, }; const props = { isExpanded: true, fieldData: { attributeContainerDataSettings: { hide: false }, }, }; describe(" Rendering Tests", () => { afterEach(cleanup); it(`Should render in the dom`, () => { render(); expect(screen.queryByTestId(testId)).toBeTruthy(); }); it(`Should show the when the type prop is TEXT`, () => { render(); expect(screen.queryByTestId(textFieldTestId)).toBeTruthy(); }); it(`Should show the when the type prop is DATE`, () => { render(); expect(screen.queryByTestId(dateFieldTestId)).toBeTruthy(); }); it(`Should show the input when the type prop is NUMBER`, () => { render(); expect(screen.queryByTestId(textFieldTestId)).toBeTruthy(); }); it(`Should show the when the type prop is CURRENCY`, () => { render(); expect(screen.queryByTestId(textFieldTestId)).toBeTruthy(); }); it(`Should show menu when the type prop is DROPDOWN`, () => { render(); expect(screen.queryByTestId(dropDownTestId)).toBeTruthy(); }); it(`Should show a checkbox & label ( the when type prop is CHECKBOXES`, () => { render(); expect(screen.queryByTestId(checkboxesTestId)).toBeTruthy(); }); it(`Should show radio input fields ( the when type prop is MULTIPLECHOICE`, () => { render(); expect(screen.queryByTestId(multipleChoiceTestId)).toBeTruthy(); }); it(`Should show a