Skip to content

Commit 3dc3df2

Browse files
committed
docs(svelte): improve description of component api usage
ref: #299
1 parent 1957b04 commit 3dc3df2

File tree

1 file changed

+8
-8
lines changed
  • docs/svelte-testing-library

1 file changed

+8
-8
lines changed

docs/svelte-testing-library/api.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ Please refer to the
5050

5151
### Results
5252

53-
| Result | Description |
54-
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
55-
| `container` | The HTML element the component is mounted into. |
56-
| `component` | The newly created Svelte component. This is mostly useful for testing exported functions or cases where manipulating the DOM doesn't fit. Outside of said cases avoid using the component directly to build tests, instead of interacting with the rendered Svelte component, work with the DOM . |
57-
| `debug` | Logs the `container` using [prettyDom](https://testing-library.com/docs/dom-testing-library/api-helpers#prettydom). |
58-
| `unmount` | Unmounts the component from the `target` by calling `component.$destroy()`. |
59-
| `rerender` | Calls render again destroying the old component, and mounting the new component on the original `target` with any new options passed in. |
60-
| `...queries` | Returns all [query functions](https://testing-library.com/docs/dom-testing-library/api-queries) that are binded to the `container`. If you pass in `query` arguments than this will be those, otherwise all. |
53+
| Result | Description |
54+
| ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
55+
| `container` | The HTML element the component is mounted into. |
56+
| `component` | The newly created Svelte component. Generally, this should only be used when testing exported functions, or when you're testing developer facing API's. Outside of said cases avoid using the component directly to build tests, instead of interacting with the rendered Svelte component, work with the DOM. Have a read of [Avoid the Test User](https://kentcdodds.com/blog/avoid-the-test-user) by Kent C. Dodds to understand the difference between the **end user** and **developer user**. |
57+
| `debug` | Logs the `container` using [prettyDom](https://testing-library.com/docs/dom-testing-library/api-helpers#prettydom). |
58+
| `unmount` | Unmounts the component from the `target` by calling `component.$destroy()`. |
59+
| `rerender` | Calls render again destroying the old component, and mounting the new component on the original `target` with any new options passed in. |
60+
| `...queries` | Returns all [query functions](https://testing-library.com/docs/dom-testing-library/api-queries) that are binded to the `container`. If you pass in `query` arguments than this will be those, otherwise all. |
6161

6262
## `cleanup`
6363

0 commit comments

Comments
 (0)