import * as React from "react"; import { render, screen, fireEvent, cleanup } from "@testing-library/react"; import ContentField from "./ContentField"; import { EditorMode } from "../../../../Editor/types"; const testId = "FormBuilder-FormFields-ContentField"; const props = { attributeContainerDataSettings: { hide: false }, }; describe(" Rendering Tests", () => { afterEach(cleanup); it(`Should render in the dom`, () => { render(); expect(screen.queryByTestId(testId)).toBeTruthy(); }); it(`Should render a rich text editor for collecting the content when in edit mode`, () => { const testId = "Editor-Components-RichEditor"; render(); expect(screen.queryByTestId(testId)).toBeTruthy(); }); it(`Should show the rendered content when in LIVE mode`, () => { const testIdLive = "FormBuilder-FormFields-ContentField-LIVE"; render(); expect(screen.queryByTestId(testIdLive)).toBeTruthy(); }); it(`Should render the AttributeContainer component when the mode is edit`, () => { const attrTestId = "FormBuilder-AttributeContainer"; render(); expect(screen.queryByTestId(attrTestId)).toBeTruthy(); }); it(`Should see that the component has been rendered in the dom`, () => { const columnsTestId = "FormBuilder-Attributes-Columns"; render(); expect(screen.queryByTestId(columnsTestId)).toBeTruthy(); }); it(`Should see that the component has been rendered in the dom`, () => { const initialValueTestId = "FormBuilder-Attributes-InitialValue"; render(); expect(screen.queryByTestId(initialValueTestId)).toBeTruthy(); }); }); describe(" Events Tests", () => { afterEach(cleanup); test.todo( `Should trigger the onChange event (via handleChange()) if the AttributeContainer's onChange event is called` ); }); describe(" Actions Tests", () => { afterEach(cleanup); test.todo( `handleChange should convert the incoming payload to LiveFormFieldProps` ); });