Pet*_* K. 5 jestjs react-native react-native-testing-library
我的屏幕上有多个不同的按钮accessibilityLabel。
<Button accessibilityLabel="First label">First</Button>
<Button accessibilityLabel="Second label">Second</Button>
Run Code Online (Sandbox Code Playgroud)
查询getByRole会忽略指定可访问性标签的第二个参数(在非本机测试库中可以正常工作)。
getByRole('button', { name: 'First label' })
Run Code Online (Sandbox Code Playgroud)
如何通过角色和标签查询元素?
| 归档时间: |
|
| 查看次数: |
1153 次 |
| 最近记录: |