Front-End34 React Testing Pattern - 설정(setup)과 해지(teardown) 설정(setup) 테스트의 시작 전 수행 동일한 환경의 보장 변수 설정, mock 주입 pre-condition 체크 해지(teardown) 테스트의 종료 후 마무리 이후 테스트에 영향이 없도록 2024. 2. 13. React Testing Library - afterAll, beforeAll, afterEach, beforeEach 간단히 이미지로 설명을 대신한다. 2024. 2. 12. React Testing Library - 개요 React Testing Library 는 Behavior Driven Test 를 위한 테스트 라이브러리로서 기존 관행이던 Implementation Driven Test 의 단점을 보완할 수 있다. 위의 두 테스트를 간단히 설명하면, - Implementation Driven Test id 특성이 부여된 h2를 사용해서 '제목'이라는 글자를 표시했을 때, 테스트 시에 1) h2 태그가 사용되었는지 2) id 특성은 맞게 부여되었는지 3) '제목' 이라는 글자가 잘 표시되는지 테스트한다. - Behavior Driven Test 화면에 '제목' 이라는 글자가 잘 표시되는지 테스트한다. h3 태그로 '제목' 글자를 표시해도 테스트를 통과할 수 있다. 사용자 입장에서는 어떤 태그가 사용되었는지 중요하지 않.. 2024. 2. 12. Element: scrollIntoView() 이벤트나 상태변화에 따라 어떤 Element 로 상위 엘리먼트의 스크롤을 이동하고자 할 때 사용하는 메서드이다. https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView Element: scrollIntoView() method - Web APIs | MDN The Element interface's scrollIntoView() method scrolls the element's ancestor containers such that the element on which scrollIntoView() is called is visible to the user. developer.mozilla.org 옵션은 2가지인데, 1. align.. 2023. 12. 5. 이전 1 2 3 4 5 6 7 ··· 9 다음