Open
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🚗 자동차 경주 게임 (typescript-racingcar)
데모페이지
https://jwon42.github.io/javascript-racingcar/
서브젝트
https://github.com/jwon42/javascript-racingcar/blob/main/README.md
📗 과제 기본 요구사항
🎯 step1
🎯🎯 step2
📝 과제를 진행하며
특징
Model,View,Controller로 기능을 분리하여 구현하고자 노력했습니다.Model에는 입력 데이터를 저장을 위한InputData클래스, 게임 진행 데이터 저장을 위한Car,Game클래스가 위치합니다.View에는 템플릿과 템플릿을 렌더링 하는 함수가 위치합니다.Controller에는 이벤트와 리스너에 관련된 함수, 게임 진행 상황에 따라Model과View를 조작하는 함수가 위치합니다.querySelector(),querySelectorAll()만을 사용했습니다.템플릿 구조
div #app내부에 3개의section으로 구분되어 있고 조건을 만족하는 경우section순차적으로 렌더링합니다.#input-section은 사용자에게 정보를 입력받는 파트입니다.#progress-section은 게임 진행 과정 출력 파트입니다.#result-section은 게임 결과 출력 파트입니다.코드 진행
app()을 실행합니다.#input-section을 렌더링하고 이벤트와 리스너를 세팅합니다.getCarName(),getTryCount()에서 입력 데이터 유효성을 체크합니다.startGame()에서 게임을 진행하며 그 과정을#progress-section에 렌더링합니다.#result-section에 렌더링합니다.div #app의childNode를 모두 삭제합니다.💡 에러 처리 (정의되지 않은 동작에 대한 내용 포함)
자동차 이름 입력
시도 횟수 입력
(수십회 이상의 횟수 입력은 원활한 게임 진행을 위해 금지시켰습니다)
📚 Cypress 테스트 케이스 목록
초기화면 로딩 테스트
자동차 이름 입력 테스트
시도 횟수 입력 테스트
진행 상황 출력 테스트
게임 재시작 테스트