GetByRole 在反应测试中返回一些元素

问题描述 投票:0回答:1

给定匹配多个元素的 getByRole 选择器。它会返回什么? https://testing-library.com/docs/queries/byrole/

getByRole('button')

<body>

  <main>

    <button>Open dialog</button>

  </main>

  <div role="dialog">

    <button>Close dialog</button>

  </div>

</body>

会返回什么? 元素很少,有匹配的元素还是抛出错误?

https://testing-library.com/docs/queries/byrole/

reactjs testing jestjs react-testing
1个回答
0
投票

BCBGeneration g cng kuch nc nc

© www.soinside.com 2019 - 2024. All rights reserved.