From bcf942efeebd62b48e05825db58761ffd716ad15 Mon Sep 17 00:00:00 2001 From: saseungmin Date: Tue, 1 Dec 2020 00:00:58 +0900 Subject: [PATCH] [Feature] Write form validation check - When the application deadline is earlier than the current time - When there is something that has not been entered - When no tag is entered --- fixtures/write-form.js | 4 +- src/components/write/WriteButtons.jsx | 5 +- src/components/write/WriteButtons.test.jsx | 21 +++- src/components/write/WriteForm.jsx | 3 +- src/components/write/WriteForm.test.jsx | 8 +- .../write/WriteButtonsContainer.jsx | 40 +++++-- .../write/WriteButtonsContainer.test.jsx | 102 +++++++++++++++--- src/reducers/slice.js | 2 +- src/reducers/slice.test.js | 4 +- 9 files changed, 154 insertions(+), 35 deletions(-) diff --git a/fixtures/write-form.js b/fixtures/write-form.js index 6d5cb55..1ce7831 100644 --- a/fixtures/write-form.js +++ b/fixtures/write-form.js @@ -2,9 +2,9 @@ const writeForm = { title: '스터디를 소개합니다.1', contents: '우리는 이것저것 합니다.1', moderatorId: 'user1', - applyEndDate: '2020-11-26', + applyEndDate: '2020-12-24 11:00', participants: [], - personnel: 10, + personnel: '1', tags: [ 'JavaScript', 'Algorithm', diff --git a/src/components/write/WriteButtons.jsx b/src/components/write/WriteButtons.jsx index 30a9aa1..c3968e0 100644 --- a/src/components/write/WriteButtons.jsx +++ b/src/components/write/WriteButtons.jsx @@ -4,8 +4,11 @@ import styled from '@emotion/styled'; const WriteButtonsWrapper = styled.div``; -const WriteButtons = ({ onSubmit, onCancel }) => ( +const WriteButtons = ({ error, onSubmit, onCancel }) => ( + {error && ( +
{error}
+ )}