Skip to content

docs(ru): add section on stubbing components to common tips #968

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

Merged
merged 2 commits into from
Sep 13, 2018
Merged
Changes from 1 commit
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
14 changes: 14 additions & 0 deletions docs/ru/guides/common-tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,20 @@ mount(Component, {
})
```

### Подмена компонентов

Вы можете переопределить компоненты, зарегистрированные глобально или локально, используя опцию `stubs`:

```js
import { mount } from '@vue/test-utils'

mount(Component, {
// Будет разрешен globally-registered-component
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Может просто компонент globally... будет заменяться пустой заглушкой

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да, так лучше, спасибо, исправил.

// пустой заглушкой
stubs: ['globally-registered-component']
})
```

### Работа с маршрутизацией

Поскольку маршрутизация по определению имеет отношение к общей структуре приложения и включает в себя несколько компонентов, её лучше всего тестировать с помощью интеграционных или end-to-end тестов. Для отдельных компонентов, которые используют возможности `vue-router`, вы можете создать моки с использованием упомянутых выше методов.
Expand Down