Skip to content

Commit cc3dfed

Browse files
Improving formatting of the note.
1 parent 24f4785 commit cc3dfed

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

docs/dom-testing-library/api-configuration.mdx

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -130,33 +130,33 @@ option.
130130
screen.getByTestId('foo', {suggest: false}) // will not throw a suggestion
131131
```
132132

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+
```
160160

161161
### `testIdAttribute`
162162

@@ -172,4 +172,4 @@ message and container object as arguments.
172172
### `asyncUtilTimeout`
173173

174174
The global timeout value in milliseconds used by `waitFor` utilities. Defaults
175-
to 1000ms.
175+
to 1000ms.

0 commit comments

Comments
 (0)