Skip to content

docs: Russian translation moved to VuePress #703

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 35 commits into from
Jun 30, 2018
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
8210198
Migrate Russian docs to VuePress
lex111 Jun 11, 2018
ecebea9
Russian docs: video link for common tips
lex111 Jun 11, 2018
88f2232
Russian docs: overwrite arrays in setData
lex111 Jun 11, 2018
41142a2
Russian docs: remove phantomjs limitation
lex111 Jun 11, 2018
357aed6
Russian translation: actualize docs
lex111 Jun 11, 2018
87bd777
Merge remote-tracking branch 'origin' into vuepress-ru
lex111 Jun 16, 2018
e73a1f3
Russian translation: silence warnings when updating prop
lex111 Jun 16, 2018
5c8acab
Russian translation: add max-len rule
lex111 Jun 16, 2018
2393f2d
Fix build
lex111 Jun 17, 2018
6b49f1f
Fix build
lex111 Jun 17, 2018
fab22dd
Fix menu items
lex111 Jun 17, 2018
4b6aa47
Russian translation: fix headings
lex111 Jun 17, 2018
4223d08
Russian translation: fix all issues
lex111 Jun 17, 2018
3a83e0c
Russian translation: more fixes
lex111 Jun 17, 2018
c6f0f06
Russian translation: fix headings of guides
lex111 Jun 17, 2018
bce0f19
Russian translation: fixes for wrapper-array
lex111 Jun 17, 2018
7559dff
Russian translation: replace shallow with shallowMount
lex111 Jun 19, 2018
7591e24
Russian translation: minor fixes
lex111 Jun 19, 2018
b0b27bf
Russian translation: fixes
lex111 Jun 19, 2018
500867b
Russian translation: fixes
lex111 Jun 19, 2018
6bb0c61
Russian translation: fixes
lex111 Jun 19, 2018
0a52a7c
Merge branch 'dev' of https://github.com/vuejs/vue-test-utils into vu…
lex111 Jun 20, 2018
00a8f94
Russian translation: tweaks
lex111 Jun 20, 2018
7f5b7c8
Russian translation: silentWarnings to silent
lex111 Jun 20, 2018
06fe6d8
Russian translation: improve document for setChecked(), setSelected()…
lex111 Jun 20, 2018
b00ef25
Russian translation: complete update in accordance with the original …
lex111 Jun 20, 2018
658e7f7
Russian translation: fix lint error
lex111 Jun 20, 2018
8344ff5
Russian translation: replace from mapCoverage to collectCoverage
lex111 Jun 20, 2018
cd6247d
Russian translation: fix anchor
lex111 Jun 21, 2018
065f3a4
Merge remote-tracking branch 'origin' into vuepress-ru
lex111 Jun 29, 2018
9b9da48
Russian translation: docs: update attributes.md
lex111 Jun 29, 2018
935f71c
Russian translation: feat: element, vnode, vm, and options are read-only
lex111 Jun 29, 2018
c20a7cd
Russian translation: feat: throw error if the read-only property is t…
lex111 Jun 29, 2018
1caef3f
Russian translation: Update README.md
lex111 Jun 29, 2018
d79cee4
Russian translation: fixes after review of @Alex-Sokolov
lex111 Jun 29, 2018
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
8 changes: 8 additions & 0 deletions docs/.vuepress/_redirects
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,11 @@

/zh/api/wrapper/* /zh/api/wrapper.html/#:splat
/zh/api/wrapper-array/* /zh/api/wrapper-array.html/#:splat

/ru/api/mount /ru/api/#mount
/ru/api/shallowMount /ru/api/#shallowmount
/ru/api/createLocalVue /ru/api/#createlocalvue
/ru/api/config /ru/api/#config

/ru/api/wrapper/* /ru/api/wrapper.html/#:splat
/ru/api/wrapper-array/* /ru/api/wrapper-array.html/#:splat
33 changes: 31 additions & 2 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ module.exports = {
lang: 'zh-CN',
title: 'Vue Test Utils',
description: '测试 Vue 组件的实用工具'
},
'/ru/': {
lang: 'ru',
title: 'Vue Test Utils',
description: 'Библиотека для тестирования Vue-компонентов'
}
},
serviceWorker: true,
Expand Down Expand Up @@ -93,7 +98,31 @@ module.exports = {
'/ja/api/options',
'/ja/api/components/'
]
}
},
'/ru/': {
label: 'Русский',
selectText: 'Переводы',
editLinkText: 'Изменить эту страницу на GitHub',
nav: [
{
text: 'API',
link: '/ru/api/'
},
{
text: 'Руководства',
link: '/ru/guides/'
}
],
sidebar: [
'/ru/',
'/ru/guides/',
'/ru/api/',
'/ru/api/wrapper/',
'/ru/api/wrapper-array/',
'/ru/api/options',
'/ru/api/components/'
]
},
}
},
markdown: {
Expand All @@ -102,4 +131,4 @@ module.exports = {
md.use(require('markdown-it-include'))
}
}
}
}
79 changes: 79 additions & 0 deletions docs/ru/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Введение

`vue-test-utils` — официальная библиотека модульного тестирования для Vue.js.

* [Руководства](guides/)
* [Введение](guides/getting-started.md)
* [Общие советы](guides/common-tips.md)
* [Мышь, клавиши и другие события DOM](guides/dom-events.md)
* [Чем запускать тесты](guides/choosing-a-test-runner.md)
* [Тестирование однофайловых компонентов с Jest](guides/testing-SFCs-with-jest.md)
* [Тестирование однофайловых компонентов с Mocha + webpack](guides/testing-SFCs-with-mocha-webpack.md)
* [Testing однофайловых компонентов с Karma](guides/testing-SFCs-with-karma.md)
* [Тестирование асинхронной логики](guides/testing-async-components.md)
* [Использование с Vue Router](guides/using-with-vue-router.md)
* [Использование с Vuex](guides/using-with-vuex.md)
* [API](api/)
* [mount](api/mount.md)
* [shallowMount](api/shallowMount.md)
* [render](api/render.md)
* [renderToString](api/renderToString.md)
* [Опции монтирования](api/options.md)
- [context](api/options.md#context)
- [slots](api/options.md#slots)
- [scopedSlots](api/options.md#scopedslots)
- [stubs](api/options.md#stubs)
- [mocks](api/options.md#mocks)
- [localVue](api/options.md#localvue)
- [attachToDocument](api/options.md#attachtodocument)
- [attrs](api/options.md#attrs)
- [listeners](api/options.md#listeners)
- [provide](api/options.md#provide)
- [sync](api/options.md#sync)
- [другие опции](api/options.md#other-options)
* [Wrapper](api/wrapper/)
* [attributes](api/wrapper/attributes.md)
* [classes](api/wrapper/classes.md)
* [contains](api/wrapper/contains.md)
* [emitted](api/wrapper/emitted.md)
* [emittedByOrder](api/wrapper/emittedByOrder.md)
* [exists](api/wrapper/exists.md)
* [destroy](api/wrapper/destroy.md)
* [find](api/wrapper/find.md)
* [findAll](api/wrapper/findAll.md)
* [html](api/wrapper/html.md)
* [is](api/wrapper/is.md)
* [isEmpty](api/wrapper/isEmpty.md)
* [isVueInstance](api/wrapper/isVueInstance.md)
* [name](api/wrapper/name.md)
* [props](api/wrapper/props.md)
* [setChecked](api/wrapper/setChecked.md)
* [setData](api/wrapper/setData.md)
* [setMethods](api/wrapper/setMethods.md)
* [setProps](api/wrapper/setProps.md)
* [setSelected](api/wrapper/setSelected.md)
* [setValue](api/wrapper/setValue.md)
* [text](api/wrapper/text.md)
* [trigger](api/wrapper/trigger.md)
* [isVisible](api/wrapper/isVisible.md)
* [WrapperArray](api/wrapper-array/)
* [at](api/wrapper-array/at.md)
* [contains](api/wrapper-array/contains.md)
* [exists](api/wrapper/exists.md)
* [destroy](api/wrapper-array/destroy.md)
* [filter](api/wrapper-array/filter.md)
* [is](api/wrapper-array/is.md)
* [isEmpty](api/wrapper-array/isEmpty.md)
* [isVueInstance](api/wrapper-array/isVueInstance.md)
* [setData](api/wrapper-array/setData.md)
* [setMethods](api/wrapper-array/setMethods.md)
* [setProps](api/wrapper-array/setProps.md)
* [trigger](api/wrapper-array/trigger.md)
* [isVisible](api/wrapper-array/isVisible.md)
* [Компоненты](api/components/)
* [TransitionStub](api/components/TransitionStub.md)
* [TransitionGroupStub](api/components/TransitionGroupStub.md)
* [RouterLinkStub](api/components/RouterLinkStub.md)
* [Селекторы](api/selectors.md)
* [createLocalVue](api/createLocalVue.md)
* [Конфигурация](api/config.md)
9 changes: 9 additions & 0 deletions docs/ru/api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# API

!!!include(docs/ru/api/mount.md)!!!
!!!include(docs/ru/api/shallowMount.md)!!!
!!!include(docs/ru/api/render.md)!!!
!!!include(docs/ru/api/renderToString.md)!!!
!!!include(docs/ru/api/selectors.md)!!!
!!!include(docs/ru/api/createLocalVue.md)!!!
!!!include(docs/ru/api/config.md)!!!
7 changes: 7 additions & 0 deletions docs/ru/api/components/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Компоненты

Vue Test Utils включает утилиты, которые вы можете использовать для создания заглушек компонентов.

!!!include(docs/ru/api/components/RouterLinkStub.md)!!!
!!!include(docs/ru/api/components/TransitionStub.md)!!!
!!!include(docs/ru/api/components/TransitionGroupStub.md)!!!
20 changes: 20 additions & 0 deletions docs/ru/api/components/RouterLinkStub.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## RouterLinkStub

Компонент для заглушки компонента Vue Router `router-link`.

Вы можете использовать этот компонент для поиска компонента router-link в дереве рендеринга.

- **Использование:**

Чтобы установить его как заглушку в опциях монтирования:

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

const wrapper = mount(Component, {
stubs: {
RouterLink: RouterLinkStub
}
})
expect(wrapper.find(RouterLinkStub).props().to).toBe('/some/path')
```
31 changes: 31 additions & 0 deletions docs/ru/api/components/TransitionGroupStub.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## TransitionGroupStub

Компонент для создания заглушки компонента `transition-group`. Вместо асинхронного выполнения переходов он возвращает дочерние компоненты синхронно.

Это настроено на заглушку всех компонентов `transition-group` по умолчанию в конфигурации vue-test-utils. Чтобы использовать стандартный компонент `transition-group` установите `config.stubs['transition-group']` в значение false:

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

config.stubs['transition-group'] = false
```

Чтобы переустановить обратно на заглушки компонентов `transition-group`:

```js
import { config, TransitionGroupStub } from '@vue/test-utils'

config.stubs['transition-group'] = TransitionGroupStub
```

Для установки заглушек в настройках монтирования:

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

mount(Component, {
stubs: {
'transition-group': TransitionGroupStub
}
})
```
30 changes: 30 additions & 0 deletions docs/ru/api/components/TransitionStub.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## TransitionStub

Компонент для создания заглушки компонента `transition`. Вместо асинхронного выполнения переходов он возвращает дочерний компонент синхронно.

Это настроено на заглушку всех компонентов `transition` по умолчанию в конфигурации vue-test-utils. Чтобы использовать стандартный компонент `transition` установите `config.stubs.transition` в значение false:

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

config.stubs.transition = false
```

Чтобы переустановить обратно на заглушки компонентов `transition`:
```js
import { config, TransitionStub } from '@vue/test-utils'

config.stubs.transition = TransitionStub
```

Для установки заглушек в настройках монтирования:

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

mount(Component, {
stubs: {
transition: TransitionStub
}
})
```
111 changes: 111 additions & 0 deletions docs/ru/api/config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
## Конфигурация

Vue Test Utils включает объект конфигурации для определения опций, используемых Vue Test Utils.

### Конфигурация настроек Vue Test Utils

### `stubs`

- Тип: `Object`
- По умолчанию: `{
transition: TransitionStub,
'transition-group': TransitionGroupStub
}`

Заглушки указанные в `config.stubs` используются по умолчанию.
Заглушки, используемые в компонентах. Они перезаписываются значениями `stubs` переданными в настройках монтирования.

При передаче `stubs` в качестве массива в настройках монтирования, `config.stubs` будет преобразована в массив, и будут создаваться компоненты заглушки с базовым компонентом, который возвращает div.

Copy link
Contributor

Choose a reason for hiding this comment

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

Пример:

```js
import VueTestUtils from '@vue/test-utils'

VueTestUtils.config.stubs['my-component'] = '<div />'
```

### `mocks`

- type: `Object`
Copy link
Contributor

Choose a reason for hiding this comment

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

type -> Тип

- default: `{}`
Copy link
Contributor

Choose a reason for hiding this comment

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

default -> по умолчанию


По аналогии с `stubs`, значения, переданные в `config.mocks` используются по умолчанию. Любые значения, переданные настройкам монтирования объекта `mocks`, будут иметь приоритет выше, по сравнению с объявленными в `config.mocks`.

Пример:

Copy link
Contributor

Choose a reason for hiding this comment

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

Example -> Пример

```js
import VueTestUtils from '@vue/test-utils'

VueTestUtils.config.mocks['$store'] = {
state: {
id: 1
}
}
```

### `methods`

- type: `Object`
- default: `{}`

Вы можете настроить методы по умолчанию с помощью объекта `config`. Это может быть полезно для плагинов, которые вводят методы в компоненты, такие как [VeeValidate](https://vee-validate.logaretm.com/). Вы можете переопределить методы, установленные в `config`, передав `methods` в настройках монтирования.
Copy link
Contributor

Choose a reason for hiding this comment

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

Also need change link to https://baianat.github.io/vee-validate/


Пример:

```js
import VueTestUtils from '@vue/test-utils'

VueTestUtils.config.methods['errors'] = () => {
any: () => false
}
```

### `provide`

- type: `Object`
- default: `{}`

Как `stubs` или `mocks`, значения, переданные `config.provide`, используются по умолчанию. Любые значения, переданные настройкам монтирования объекта `provide`, будут иметь приоритет выше по сравнению с объявленными в `config.provide`. **Обратите внимание, что не поддерживается передача функции в качестве `config.provide`.**

Пример:

```js
import VueTestUtils from '@vue/test-utils'

VueTestUtils.config.provide['$logger'] = {
log: (...args) => {
console.log(...args)
}
}
```

### `logModifiedComponents`

- type: `Boolean`
- default: `true`

Логирует о предупреждениях, когда для расширенных дочерних компонентов автоматически создаётся заглушка. Скрывает предупреждения, когда установлено значение `false`. В отличие от других опций конфигурации, это невозможно установить в настройках монтирования.

Пример:

```js
import VueTestUtils from '@vue/test-utils'

VueTestUtils.config.logModifiedComponents = false
```

### `silentWarnings`

- type: `Boolean`
- default: `true`

Подавляет предупреждения, вызванные Vue во время изменения наблюдаемых компонентов (например, входных параметров). Если установлено значение `false`, все предупреждения показываются в консоли. Это настраиваемый способ, который основывается на `Vue.config.silent`.

Пример:

```js
import VueTestUtils from '@vue/test-utils'

VueTestUtils.config.silentWarnings = false
```
27 changes: 27 additions & 0 deletions docs/ru/api/createLocalVue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## createLocalVue()

- **Возвращает:**
- `{Component}`

- **Использование:**

`createLocalVue` возвращает класс Vue, чтобы вы могли добавлять компоненты, примеси и устанавливать плагины без загрузнения глобального класса Vue.

Используйте вместе с `options.localVue`:

```js
import { createLocalVue, shallowMount } from '@vue/test-utils'
import Foo from './Foo.vue'
Copy link
Contributor

Choose a reason for hiding this comment

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

shallow -> shallowMount

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@38elements thank you! I have not everywhere before made a replacement, now thanks to you, I replaced everywhere with shallow on shallowMount


const localVue = createLocalVue()
const wrapper = shallowMount(Foo, {
localVue,
mocks: { foo: true }
})
expect(wrapper.vm.foo).toBe(true)

const freshWrapper = shallowMount(Foo)
expect(freshWrapper.vm.foo).toBe(false)
```

- **См. также:** [Общие советы](../guides/common-tips.md#applying-global-plugins-and-mixins)
Loading