@@ -130,33 +130,33 @@ option.
130
130
screen .getByTestId (' foo' , {suggest: false }) // will not throw a suggestion
131
131
```
132
132
133
- > :::note
134
- >
135
- > When this option is enabled, the library may provide suggestions that lack an
136
- > intuitive implementation, this typically occurs for
137
- > [ roles which can not be named] ( https://w3c.github.io/aria/#namefromprohibited ) ,
138
- > most notably paragraphs. For instance, if you attempt to use
139
- > [ ` getByText ` ] ( queries/bytext.mdx ) , you may encounter the following error:
140
- >
141
- > ```
142
- > TestingLibraryElementError: A better query is available, try this:
143
- > getByRole('paragraph')
144
- > ```
145
- >
146
- > However, there is no direct way to query paragraphs using an object as the
147
- > second parameter, such as in
148
- > `getByRole('paragraph', { name: 'Hello World' })`.
149
- >
150
- > To address this issue, you can leverage a custom function to validate the
151
- > element's structure and suppress the error, see
152
- > [#1306](https://github.com/testing-library/dom-testing-library/issues/1306)
153
- > and the example below:
154
- >
155
- > ```js
156
- > getByRole('paragraph', {
157
- > name: (_, element) => element.textContent === 'Hello world',
158
- > })
159
- > ```
133
+ :::note
134
+
135
+ When this option is enabled, the library may provide suggestions that lack an
136
+ intuitive implementation, this typically occurs for
137
+ [ roles which can not be named] ( https://w3c.github.io/aria/#namefromprohibited ) ,
138
+ most notably paragraphs. For instance, if you attempt to use
139
+ [ ` getByText ` ] ( queries/bytext.mdx ) , you may encounter the following error:
140
+
141
+ ```
142
+ TestingLibraryElementError: A better query is available, try this:
143
+ getByRole('paragraph')
144
+ ```
145
+
146
+ However, there is no direct way to query paragraphs using an object as the
147
+ second parameter, such as in
148
+ ` getByRole('paragraph', { name: 'Hello World' }) ` .
149
+
150
+ To address this issue, you can leverage a custom function to validate the
151
+ element's structure and suppress the error, see
152
+ [ #1306 ] ( https://github.com/testing-library/dom-testing-library/issues/1306 )
153
+ and the example below:
154
+
155
+ ``` js
156
+ getByRole (' paragraph' , {
157
+ name : (_ , element ) => element .textContent === ' Hello world' ,
158
+ })
159
+ ```
160
160
161
161
### ` testIdAttribute `
162
162
@@ -172,4 +172,4 @@ message and container object as arguments.
172
172
### ` asyncUtilTimeout `
173
173
174
174
The global timeout value in milliseconds used by ` waitFor ` utilities. Defaults
175
- to 1000ms.
175
+ to 1000ms.
0 commit comments