From dfc85fffe2fed66129922a5bbb24a27816124d66 Mon Sep 17 00:00:00 2001 From: pedronunes19 Date: Mon, 27 Nov 2023 17:39:13 +0000 Subject: [PATCH] remove advanced settings collapsible --- .../Offers/Edit/EditOfferForm.spec.js | 42 -------- .../Offers/Form/form-components/OfferForm.js | 96 ++++++------------- .../Form/form-components/offerStyles.js | 5 +- .../Offers/New/CreateOfferForm.spec.js | 39 -------- 4 files changed, 31 insertions(+), 151 deletions(-) diff --git a/src/components/Offers/Edit/EditOfferForm.spec.js b/src/components/Offers/Edit/EditOfferForm.spec.js index a2f42483..fbb0cd42 100644 --- a/src/components/Offers/Edit/EditOfferForm.spec.js +++ b/src/components/Offers/Edit/EditOfferForm.spec.js @@ -263,48 +263,6 @@ describe("Edit Offer Form", () => { expect(screen.getByLabelText("Application URL").getAttribute("value")).toBe(offer.applyURL); }); - it("should not be visible advanced settings", () => { - useSession.mockImplementation(() => ({ isLoggedIn: true, data: { company: { _id: "company_id" } } })); - useOffer.mockImplementation(() => ({ offer, loading: false, error: null, mutate: () => {} })); - - renderWithStoreAndTheme( - - - - - - - , - { initialState, theme } - ); - - expect(screen.queryByText("Publication Date *")).not.toBeVisible(); - expect(screen.queryByText("Publication End Date *")).not.toBeVisible(); - }); - - it("should be visible advanced settings after clicking the button", async () => { - - useSession.mockImplementation(() => ({ isLoggedIn: true, data: { company: { _id: "company_id" } } })); - useOffer.mockImplementation(() => ({ offer, loading: false, error: null, mutate: () => {} })); - - renderWithStoreAndTheme( - - - - - - - , - { initialState, theme } - ); - - await act(() => { - fireEvent.click(screen.getByText("Advanced Settings")); - }); - - expect(screen.getByText("Publication Date *")).toBeVisible(); - expect(screen.getByText("Publication End Date *")).toBeVisible(); - }); it("should not submit dates if not edited", async () => { useSession.mockImplementation(() => ({ isLoggedIn: true, data: { company: { _id: "company_id" } } })); diff --git a/src/components/Offers/Form/form-components/OfferForm.js b/src/components/Offers/Form/form-components/OfferForm.js index 0c87412d..f91f37f9 100644 --- a/src/components/Offers/Form/form-components/OfferForm.js +++ b/src/components/Offers/Form/form-components/OfferForm.js @@ -6,10 +6,9 @@ import { Grid, FormControl, Typography, - Collapse, Button, } from "@material-ui/core"; -import React, { useState, useCallback, useContext, useEffect } from "react"; +import React, { useContext, useEffect } from "react"; import { Redirect } from "react-router-dom"; import PropTypes from "prop-types"; import MultiOptionTextField from "../../../utils/form/MultiOptionTextField"; @@ -27,10 +26,6 @@ import PublicationDateComponent from "./PublicationDateComponent"; import PublicationEndDateComponent from "./PublicationEndDateComponent"; import IsHiddenComponent from "./IsHiddenComponent"; import TextEditorComponent from "./TextEditorComponent"; -import { - KeyboardArrowDown, - KeyboardArrowUp, -} from "@material-ui/icons"; import useOfferFormStyles from "./offerStyles"; import { Controller } from "react-hook-form"; import { useMobile } from "../../../../utils/media-queries"; @@ -85,22 +80,6 @@ const OfferForm = ({ context, title }) => { const formDisabled = !isLoggedIn || companyUnfinishedRegistration; - const [isAdvancedOpen, setAdvancedOpen] = useState(false); - - const shouldShowAdvancedOptions = useCallback(() => ( - isAdvancedOpen || - !!errors.publishDate || !!requestErrors.publishDate || - !!errors.publishEndDate || !!requestErrors.publishEndDate || - !!errors.isHidden - ), [ - errors.isHidden, - errors.publishDate, - errors.publishEndDate, - isAdvancedOpen, - requestErrors.publishDate, - requestErrors.publishEndDate, - ]); - const Content = isMobile ? DialogContent : CardContent; const classes = useOfferFormStyles(isMobile)(); @@ -271,57 +250,42 @@ const OfferForm = ({ context, title }) => { /> - - - - - - - - + + + + + + + + { + showHiddenField && - - { - showHiddenField && - - - - } - - + } + makeStyles((theme) => ({ autocompleteChipWrapper: { minHeight: "40px", }, - advancedSettingsDatePicker: { + publicationDatePicker: { width: "100%", marginRight: theme.spacing(2), }, @@ -56,9 +56,6 @@ export default (isMobile) => makeStyles((theme) => ({ vacanciesGrid: { marginBottom: theme.spacing(5), }, - advancedSettingsCollapse: { - marginBottom: theme.spacing(4), - }, jobTypeGrid: { marginBottom: theme.spacing(4), }, diff --git a/src/components/Offers/New/CreateOfferForm.spec.js b/src/components/Offers/New/CreateOfferForm.spec.js index 7fc07fed..795d37e6 100644 --- a/src/components/Offers/New/CreateOfferForm.spec.js +++ b/src/components/Offers/New/CreateOfferForm.spec.js @@ -151,45 +151,6 @@ describe("Create Offer Form", () => { expect(screen.getByText("Submit").parentNode).toBeEnabled(); }); - it("should not be visible advanced settings", () => { - useSession.mockImplementation(() => ({ isLoggedIn: true, data: { company: { name: "Company Name" } } })); - - renderWithStoreAndTheme( - - - - - - - , - { initialState, theme } - ); - - expect(screen.queryByText("Publication Date *")).not.toBeVisible(); - expect(screen.queryByText("Publication End Date *")).not.toBeVisible(); - expect(screen.queryByText("Hide offer")).not.toBeVisible(); - }); - - it("should be visible advanced settings after clicking the button", async () => { - useSession.mockImplementation(() => ({ isLoggedIn: true, data: { company: { name: "Company Name" } } })); - - renderWithStoreAndTheme( - - - - - - - , - { initialState, theme } - ); - - await fireEvent.click(screen.getByText("Advanced Settings")); - - expect(screen.queryByText("Publication Date *")).toBeVisible(); - expect(screen.queryByText("Publication End Date *")).toBeVisible(); - expect(screen.queryByText("Hide offer")).toBeVisible(); - }); it("should not have job type options with null value", async () => { useSession.mockImplementation(() => ({ isLoggedIn: true, data: { company: { name: "Company Name" } } }));