From 157d89d6030d45cad5e4e796ce838df5119ea110 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Teklinski?= Date: Mon, 18 May 2020 10:13:44 +0200 Subject: [PATCH 1/2] docs(wrapper): add deprection warning Add deprecation notice for `wrapper.is()` method with couple examples how it could be replaced. --- docs/api/wrapper/is.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/api/wrapper/is.md b/docs/api/wrapper/is.md index 648f852c2..1451cf299 100644 --- a/docs/api/wrapper/is.md +++ b/docs/api/wrapper/is.md @@ -1,5 +1,20 @@ ## is +::: warning Deprecation warning +Using `is` to assert that DOM node or `vm` matches selector is deprecated and will be removed. + +Consider a custom matcher such as those provided in jest-dom: https://github.com/testing-library/jest-dom#custom-matchers +or for DOM element type assertion use native [`Element.tagName`](https://developer.mozilla.org/en-US/docs/Web/API/Element/tagName) instead. + +To keep these tests, a valid replacement for: + +- `is('DOM_SELECTOR')` is a assertion of `wrapper.element.tagName`. +- `is('ATTR_NAME')` is a truthy assertion of `wrapper.attributes('ATTR_NAME')`. +- `is('CLASS_NAME')` is a truthy assertion of `wrapper.classes('CLASS_NAME')`. + +When using with findComponent, access the DOM element with `findComponent(Comp).element` +::: + Assert `Wrapper` DOM node or `vm` matches [selector](../selectors.md). - **Arguments:** From 733b6b21d6b994bbdb4fe1cfe1934752dfb713bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Tekli=C5=84ski?= Date: Mon, 18 May 2020 11:03:16 +0200 Subject: [PATCH 2/2] Update docs/api/wrapper/is.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: AdriĆ  Fontcuberta --- docs/api/wrapper/is.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/wrapper/is.md b/docs/api/wrapper/is.md index 1451cf299..9aea5978a 100644 --- a/docs/api/wrapper/is.md +++ b/docs/api/wrapper/is.md @@ -3,7 +3,7 @@ ::: warning Deprecation warning Using `is` to assert that DOM node or `vm` matches selector is deprecated and will be removed. -Consider a custom matcher such as those provided in jest-dom: https://github.com/testing-library/jest-dom#custom-matchers +Consider a custom matcher such as those provided in [jest-dom](https://github.com/testing-library/jest-dom#custom-matchers). or for DOM element type assertion use native [`Element.tagName`](https://developer.mozilla.org/en-US/docs/Web/API/Element/tagName) instead. To keep these tests, a valid replacement for: