-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* chore: jest 환경 설정 * feat: 공백 제거 유틸함수 추가 및 테스트코드 작성 * fix: 프로젝트 명 공백 입력 오류 수정 - autoFocus추가 * refactor: ol 태그 외부에있는 p 태그 제거 * refactor: 함수명과 내부 동작 불일치된 부분 수정 * refactor: 어색한 코드 라인 수정 및 프로젝트 이름 중복체크 기능 추가
- Loading branch information
Showing
11 changed files
with
259 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"preset": "ts-jest", | ||
"moduleDirectories": ["node_modules", "src"], | ||
"transform": { | ||
"node_modules/variables/.+\\.(j|t)sx?$": "ts-jest", | ||
".+\\.(svg|css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$": "jest-transform-stub" | ||
}, | ||
"coveragePathIgnorePatterns": ["/node_modules/", "/jest"], | ||
"testEnvironment": "jsdom" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { isEmptyString } from "../../utils/validation"; | ||
|
||
describe("isEmptyString", () => { | ||
test("문자열을 인자로 넣을 시, 해당 문자열이 공백 또는 개행으로만 이루어져 있는지 여부를 반환한다.", () => { | ||
const fixture = [ | ||
{ | ||
input: " ", | ||
expectedOutput: true | ||
}, | ||
{ | ||
input: " \n \n \n ", | ||
expectedOutput: true | ||
}, | ||
{ | ||
input: "a", | ||
expectedOutput: false | ||
}, | ||
{ | ||
input: " a a a \na a \nna\n ", | ||
expectedOutput: false | ||
}, | ||
{ | ||
input: "\n\n\n\n\n\n ", | ||
expectedOutput: true | ||
} | ||
]; | ||
|
||
fixture.forEach(({ input, expectedOutput }) => { | ||
expect(isEmptyString(input)).toEqual(expectedOutput); | ||
}); | ||
}); | ||
}); |
19 changes: 3 additions & 16 deletions
19
frontend/manage/src/components/pages/NewProjectPage/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,10 @@ | ||
import { FormEvent } from "react"; | ||
import { useHistory } from "react-router-dom"; | ||
import { ROUTE } from "../../../constants"; | ||
import { useCreateProject, useInput } from "../../../hooks"; | ||
import { useGetAllProjects } from "../../../hooks"; | ||
import NewProject from "../../templates/NewProject"; | ||
|
||
const NewProjectPage = () => { | ||
const history = useHistory(); | ||
const { createProject } = useCreateProject(); | ||
const { value: projectName, onChange: onChangeProjectName } = useInput(""); | ||
const { projects } = useGetAllProjects(); | ||
|
||
const onSubmit = async (event: FormEvent<HTMLFormElement>) => { | ||
event.preventDefault(); | ||
|
||
const project = await createProject(projectName); | ||
|
||
history.push(ROUTE.GET_SCRIPT_PUBLISHING(project.id)); | ||
}; | ||
|
||
return <NewProject onSubmit={onSubmit} projectName={projectName} onChangeProjectName={onChangeProjectName} />; | ||
return <NewProject projects={projects} />; | ||
}; | ||
|
||
export default NewProjectPage; |
35 changes: 30 additions & 5 deletions
35
frontend/manage/src/components/templates/NewProject/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const allSpaces = /(\s*)/g; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
export enum PALETTE { | ||
"PRIMARY"= "#10DF99", | ||
"SECONDARY" = "#0BC586", | ||
"TERTIARY" = "#FFE200", | ||
"WHITE" = "#FFFFFF", | ||
"BLACK_700" = "#303030", | ||
"PRIMARY" = "#10DF99", | ||
"SECONDARY" = "#0BC586", | ||
"TERTIARY" = "#FFE200", | ||
"WHITE" = "#FFFFFF", | ||
"BLACK_700" = "#303030", | ||
"RED_600" = "#E41E1E" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { allSpaces } from "../constants/regex"; | ||
|
||
export const isEmptyString = (str: string) => str.replace(allSpaces, "").length === 0; |
Oops, something went wrong.