import * as React from "react"; import { render, screen, fireEvent, cleanup } from "@testing-library/react"; import reactToCSS from "react-style-object-to-css"; import { styleClean } from "@sc/utils"; import Checkboxes from "./Checkboxes"; import { data } from "./Checkboxes.stories"; import { styleData } from "../../FormBuilder.stories"; import { EditorMode } from "../../../../Editor/types"; const testId = "FormBuilder-FormFields-Checkboxes"; const descriptionTestId = "FormBuilder-Attributes-Description"; const requiredTestId = "FormBuilder-Attributes-Required"; const labelTestId = "FormBuilder-Attributes-Label"; const props = { data, styles: styleData, attributeContainerDataSettings: { hide: false }, }; describe(" Rendering Tests", () => { afterEach(cleanup); it(`Should render in the dom`, () => { render(); expect(screen.queryByTestId(testId)).toBeTruthy(); }); it(`Should render an EDITOR or LIVE version of the component based on the value of the mode prop`, () => { const testIdLive = "FormBuilder-FormFields-Checkboxes-LIVE"; const testIdEditor = "FormBuilder-FormFields-Checkboxes-EDITOR"; const { rerender } = render( ); expect(screen.queryByTestId(testIdLive)).toBeTruthy(); rerender(); expect(screen.queryByTestId(testIdEditor)).toBeTruthy(); }); it(`Should render a regular list of checkboxes when the mode is live`, () => { const testId = "FormBuilder-FormFields-Checkboxes-Checkbox"; render(); expect(screen.queryAllByTestId(testId).length).toEqual(data.length); }); it(`Should render the AttributeContainer component when the mode is edit`, () => { const attrTestId = "FormBuilder-AttributeContainer"; render(); expect(screen.queryByTestId(attrTestId)).toBeTruthy(); }); test.skip(`Should render a question that asks whether or not to show it as a checkbox or a toggle switch`, () => {}); it(`Should see that the