ByTitle[Testing Library]

SnowCat·2023년 3월 6일
0

Testing Library

목록 보기
7/11
post-thumbnail
getByTitle(
  container?: HTMLElement,
  title: TextMatch,
  options?: {
    exact?: boolean = true,
    normalizer?: NormalizerFn,
  }): HTMLElement

<span title="Delete" id="2"></span>
<svg>
  <title>Close</title>
  <g><path /></g>
</svg>

//test

import {screen} from '@testing-library/dom'

const deleteElement = screen.getByTitle('Delete')
const closeElement = screen.getByTitle('Close')
  • 엘리먼트의 title을 찾는 메서드

출처:
https://testing-library.com/docs/queries/bytitle

profile
냐아아아아아아아아앙

0개의 댓글