방구석 개발자의 놀이터

  • 홈
  • 태그
  • 방명록

testing-library 1

[Testing-libarary] Modal open 확인 테스트 코드 작성 시 주의사항

open modal 버튼을 클릭 시 Modal Component가 렌더링 된다고 할 때 click 함수를 어떤걸 사용할지에 따라 테스트코드는 다음과 같이 작성할 수 있다. 1. fireEvent.click을 사용할 경우 it("부모 컴포넌트 state를 이용한 모달 버튼을 클릭하면 모달이 나타난다", () => { renderComponent(); //모달이 처음에는 보이지 않는다 expect(screen.queryByText("모달 타이틀")).toBeNull(); //버튼 클릭 시 모달 등장 const buttons = screen.getAllByText("open modal"); fireEvent.click(buttons[0]); //모달 등장 const modal = screen.getByTest..

Front-End/Test 2023.02.23
이전
1
다음
더보기
프로필사진

게으른 사람들에게 편리함을 제공해 줄 수 있을 때 가장 기쁜 개발자

250x250
  • 분류 전체보기 (102)
    • JAVA (2)
    • Spring (17)
    • Python (14)
    • 회고록 (4)
    • Flutter (3)
    • Git (1)
    • Spring Boot (15)
    • Algorithm (3)
    • AWS (1)
    • Front-End (34)
      • HTML (1)
      • CSS (1)
      • SCSS (2)
      • JavaScript (12)
      • React (13)
      • React-query (1)
      • NextJS (0)
      • Test (1)
    • OpenSource (3)
    • 독서 (0)
    • 강의 (1)
    • Error (4)

Tag

es6, springboot, javascript, front-end, lombok, 회고록, 개발자, frontend, spring, springframework, flutter, component, opensource, 프론트엔드, aspect, react, react-router-dom, PYTHON, spring boot, CSS,

최근글과 인기글

  • 최근글
  • 인기글

최근댓글

공지사항

페이스북 트위터 플러그인

  • Facebook
  • Twitter

Archives

Calendar

«   2025/05   »
일 월 화 수 목 금 토
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

방문자수Total

  • Today :
  • Yesterday :

Copyright © Kakao Corp. All rights reserved.

티스토리툴바