// import { fireEvent, render } from "@testing-library/react"; // import { createForm } from "factory"; describe("FormPage [ Base ]", () => { // type SighUpForm = { // user: { // email: string; // password: string; // confirmPassword: string; // }; // }; // let formInstance = createForm( // { // user: { // email: "", // password: "", // confirmPassword: "", // }, // }, // { // pages: 2, // }, // ); beforeEach(() => { // formInstance = createForm( // { // user: { // email: "", // password: "", // confirmPassword: "", // }, // }, // { // pages: 2, // }, // ); }); // describe("when multi-page form", () => { // it("should move between pages", async () => { // const { Form, FormButton, FormPage, useActions } = formInstance; // const onSubmit = jest.fn(); // const App = () => { // const { goNext, goBack } = useActions(); // return ( //
// // Page 1 // {/* */} // // // Page 2 // {/* */} // {/* */} // // // Submit // // // Next // // // Back // //
// ); // }; // const { getByTestId, queryByTestId, findByTestId } = render(); // const emailInput = getByTestId("user.email"); // expect(emailInput).toBeInTheDocument(); // expect(queryByTestId("user.password")).not.toBeInTheDocument(); // expect(queryByTestId("user.confirmPassword")).not.toBeInTheDocument(); // fireEvent.change(emailInput, { target: { value: "test" } }); // expect(emailInput).toHaveValue("test"); // const nextButton = getByTestId("next"); // const backButton = getByTestId("back"); // fireEvent.click(nextButton); // await findByTestId("user.password"); // await findByTestId("user.confirmPassword"); // expect(getByTestId("user.password")).toBeInTheDocument(); // expect(getByTestId("user.confirmPassword")).toBeInTheDocument(); // fireEvent.click(backButton); // await findByTestId("user.email"); // expect(emailInput).toHaveValue("test"); // }); // }); });