Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(wrapper-array): add is warning #1920

Merged
merged 1 commit into from
Nov 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions docs/fr/api/wrapper-array/is.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
## is

::: warning Avertissement de déprédation
L'utilisation de `is` pour affirmer que le nœud DOM est déprécié et sera supprimé.

Considérez un appariement personnalisé tel que ceux fournis dans [jest-dom](https://github.com/testing-library/jest-dom#custom-matchers).
ou pour l'assertion de type d'élément DOM, utilisez native [`Element.tagName`](https://developer.mozilla.org/en-US/docs/Web/API/Element/tagName) à la place.

Pour conserver ces tests, un remplacement valable pour :

- `is('DOM_SELECTOR')` est une affirmation de `wrapper.wrappers.every(wrapper => wrapper.element.tagName === 'DOM_SELECTOR')`.
- `is('ATTR_NAME')` est une affirmation véridique d `wrapper.wrappers.every(wrapper => wrapper.attributes('ATTR_NAME'))`.
- `is('CLASS_NAME')` est une affirmation véridique d `wrapper.wrappers.every(wrapper => wrapper.classes('CLASS_NAME'))`.

L'affirmation contre la définition du composant n'est pas dépréciée

En cas d'utilisation avec findComponent, accédez à l'élément DOM avec `findComponent(Comp).element`
:::

Affirmer que chaque `Wrapper` dans le noeud DOM `WrapperArray` ou `vm` correspond à [selector](../selectors.md).

- **Arguments:**
Expand Down
14 changes: 14 additions & 0 deletions docs/ja/api/wrapper-array/is.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
## is(selector)

::: warning Deprecation warning
`is` を使用して、 DOM ノードまたは `vm` がセレクタに一致することをアサートするのは非推奨となり、削除される予定です。

[jest-dom](https://github.com/testing-library/jest-dom#custom-matchers) で提供されているようなカスタムマッチャの使用を検討してください。または、 DOM 要素などに対するアサーションには、代わりにネイティブの [Element.tagName](https://developer.mozilla.org/en-US/docs/Web/API/Element/tagName) を使用してください。

テストを維持するためには、以下の置き換えが有効です。

- `is('DOM_SELECTOR')` は `wrapper.wrappers.every(wrapper => wrapper.element.tagName === 'DOM_SELECTOR')` のアサーションです。
- `is('ATTR_NAME')` は真に `wrapper.wrappers.every(wrapper => wrapper.attributes('ATTR_NAME'))` のアサーションです。
- `is('CLASS_NAME')` は真に `wrapper.wrappers.every(wrapper => wrapper.classes('CLASS_NAME'))` のアサーションです。

findComponent で使用する場合は、 `findComponent(Comp).element` で DOM 要素にアクセスします。
:::

`WrapperArray` の全ての `Wrapper` の DOM ノード、もしくは[セレクタ](../selectors.md)が `vm` とマッチするか検証します。

- **引数:**
Expand Down
14 changes: 14 additions & 0 deletions docs/zh/api/wrapper-array/is.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
## is

::: warning 废弃警告
使用 `is` 断言 DOM 结点或 `vm` 匹配选择器的方式已经被废弃并会被移除。

可以考虑一个诸如 [jest-dom](https://github.com/testing-library/jest-dom#custom-matchers) 提供的自定义匹配。或为 DOM 元素类型断言换用原生的 [`Element.tagName`](https://developer.mozilla.org/en-US/docs/Web/API/Element/tagName)。

为了保留这些测试,一个有效替换:

- `is('DOM_SELECTOR')` 的方式是一个 `wrapper.wrappers.every(wrapper => wrapper.element.tagName === 'DOM_SELECTOR')` 的断言。
- `is('ATTR_NAME')` 的方式是一个 `wrapper.wrappers.every(wrapper => wrapper.attributes('ATTR_NAME'))` 的 truthy 断言。
- `is('CLASS_NAME')` 的方式是一个 `wrapper.wrappers.every(wrapper => wrapper.classes('CLASS_NAME'))` 的 truthy 断言。

当使用 `findComponent` 时,通过 `findComponent(Comp).element` 访问 DOM 元素。
:::

断言 `WrapperArray` 的每个 `Wrapper` 的 DOM 节点或 `vm` 匹配[选择器](../selectors.md)。

- **参数:**
Expand Down