File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -215,16 +215,22 @@ If it is important that you query an actual `<label>` element you can provide a
215
215
< textarea>< / textarea>
216
216
< / label>
217
217
218
- // for/htmlFor between label and an element that is not a form element
219
- < section id= " photos-section" >
220
- < label for = " photos-section" > Photos< / label>
221
- < / section>
222
218
```
223
219
224
220
``` js
225
221
const inputNode = screen .getByLabelText (' Username' , { selector: ' input' })
226
222
```
227
223
224
+ Note that ` findByLabelText will not work in the case where a ` for` attr on a ` label` matches and ` id` field on a non-form element.
225
+
226
+ ``` js
227
+ // This case is not valid
228
+ // for/htmlFor between label and an element that is not a form element
229
+ < section id= " photos-section" >
230
+ < label for = " photos-section" > Photos< / label>
231
+ < / section>
232
+ ```
233
+
228
234
### ` ByPlaceholderText `
229
235
230
236
> getByPlaceholderText, queryByPlaceholderText, getAllByPlaceholderText,
You can’t perform that action at this time.
0 commit comments