Skip to content

Commit e5b0f00

Browse files
teklakctafontcu
andauthored
fix #1550: add deprection warning (#1551)
* docs(wrapper): add deprection warning Add deprecation notice for `wrapper.is()` method with couple examples how it could be replaced. * Update docs/api/wrapper/is.md Co-authored-by: Adrià Fontcuberta <[email protected]> Co-authored-by: Adrià Fontcuberta <[email protected]>
1 parent d981830 commit e5b0f00

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Diff for: docs/api/wrapper/is.md

+15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
## is
22

3+
::: warning Deprecation warning
4+
Using `is` to assert that DOM node or `vm` matches selector is deprecated and will be removed.
5+
6+
Consider a custom matcher such as those provided in [jest-dom](https://github.com/testing-library/jest-dom#custom-matchers).
7+
or for DOM element type assertion use native [`Element.tagName`](https://developer.mozilla.org/en-US/docs/Web/API/Element/tagName) instead.
8+
9+
To keep these tests, a valid replacement for:
10+
11+
- `is('DOM_SELECTOR')` is a assertion of `wrapper.element.tagName`.
12+
- `is('ATTR_NAME')` is a truthy assertion of `wrapper.attributes('ATTR_NAME')`.
13+
- `is('CLASS_NAME')` is a truthy assertion of `wrapper.classes('CLASS_NAME')`.
14+
15+
When using with findComponent, access the DOM element with `findComponent(Comp).element`
16+
:::
17+
318
Assert `Wrapper` DOM node or `vm` matches [selector](../selectors.md).
419

520
- **Arguments:**

0 commit comments

Comments
 (0)