Skip to content

Commit 83aa823

Browse files
phegmanpeterhegman
and
peterhegman
authored
docs(test-utils): add tip about using trigger('focus') (#1848)
When using `trigger('focus')` with jsdom v16.4.0 and above you must use `attachTo` when mounting the component. Co-authored-by: peterhegman <[email protected]>
1 parent 7e78174 commit 83aa823

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

docs/api/wrapper/trigger.md

+4
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ test('trigger demo', async () => {
3838
})
3939
```
4040

41+
::: tip
42+
When using `trigger('focus')` with [jsdom v16.4.0](https://github.com/jsdom/jsdom/releases/tag/16.4.0) and above you must use the [attachTo](../options.md#attachto) option when mounting the component. This is because a bug fix in [jsdom v16.4.0](https://github.com/jsdom/jsdom/releases/tag/16.4.0) changed `el.focus()` to do nothing on elements that are disconnected from the DOM.
43+
:::
44+
4145
- **Setting the event target:**
4246

4347
Under the hood, `trigger` creates an `Event` object and dispatches the event on the Wrapper element.

0 commit comments

Comments
 (0)