-
Notifications
You must be signed in to change notification settings - Fork 665
Translate pt br #185
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
Translate pt br #185
Changes from 61 commits
5b9925a
683d484
ecd089b
e11ce65
437ff13
87b457f
b837439
227ab6e
85160dd
72af722
2c19d32
e6d96bc
07f7e00
11a6ddb
0ae8005
4a2925c
d231822
6bb0a39
941e4c3
f59cb0b
d8e4958
48d02cd
7ade7d5
3324044
5e60fbf
aa8d4d1
7d653fe
abbd97f
0e58ba8
cff9d1c
e8284bd
9834851
5f1d01c
a18c872
3fbea31
e3cc69a
a6d1313
5e8574a
f9a0991
4cac913
918ad1e
8d6eb56
49a8064
394c8f5
7336700
5ed7f57
260759c
2f3fcc2
b7c494b
ae1a267
a72cd4e
4a24493
0273090
6a9573c
40d4665
01cc393
ae44b17
aa3aa12
99859f2
ba9757d
1c460ce
dfd1428
6b4a769
30b63ca
6ccc0b2
e411fc3
03c850d
55b978f
701d795
d2fb5b7
79e1cad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
* [English](en/) | ||
* [日本語](ja/) | ||
* [简体中文](zh-cn/) | ||
* [Portuguese (Brazil)](pt-br/) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# vue-test-utils | ||
|
||
`vue-test-utils` é a biblioteca oficial de testes de unidade para o Vue.js. | ||
|
||
## Índice | ||
|
||
* [Guia](guides/README.md) | ||
* [Iniciando](guides/getting-started.md) | ||
* [Dicas comuns](guides/common-tips.md) | ||
* [Mouse, Tecla e outros eventos do DOM](guides/dom-events.md) | ||
* [Escolhendo um executador de testes](guides/choosing-a-test-runner.md) | ||
* [Testando SFCs com Jest](guides/testing-SFCs-with-jest.md) | ||
* [Testando SFCs com Mocha + webpack](guides/testing-SFCs-with-mocha-webpack.md) | ||
* [Usando com o Vue Router](guides/using-with-vue-router.md) | ||
* [Usando com o Vuex](guides/using-with-vuex.md) | ||
* [API](api/README.md) | ||
* [mount](api/mount.md) | ||
* [shallow](api/shallow.md) | ||
* [Opções de montagem](api/options.md) | ||
- [context](api/options.md#context) | ||
- [slots](api/options.md#slots) | ||
- [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) | ||
- [clone](api/options.md#clone) | ||
* [Wrapper (embrulho)](api/wrapper/README.md) | ||
* [contains](api/wrapper/contains.md) | ||
* [emitted](api/wrapper/emitted.md) | ||
* [emittedByOrder](api/wrapper/emittedByOrder.md) | ||
* [find](api/wrapper/find.md) | ||
* [findAll](api/wrapper/findAll.md) | ||
* [hasAttribute](api/wrapper/hasAttribute.md) | ||
* [hasClass](api/wrapper/hasClass.md) | ||
* [hasProp](api/wrapper/hasProp.md) | ||
* [hasStyle](api/wrapper/hasStyle.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) | ||
* [setComputed](api/wrapper/setComputed.md) | ||
* [setData](api/wrapper/setData.md) | ||
* [setMethods](api/wrapper/setMethods.md) | ||
* [setProps](api/wrapper/setProps.md) | ||
* [text](api/wrapper/text.md) | ||
* [trigger](api/wrapper/trigger.md) | ||
* [update](api/wrapper/update.md) | ||
* [destroy](api/wrapper/destroy.md) | ||
* [WrapperArray](api/wrapper-array/README.md) | ||
* [at](api/wrapper-array/at.md) | ||
* [contains](api/wrapper-array/contains.md) | ||
* [hasAttribute](api/wrapper-array/hasAttribute.md) | ||
* [hasClass](api/wrapper-array/hasClass.md) | ||
* [hasProp](api/wrapper-array/hasProp.md) | ||
* [hasStyle](api/wrapper-array/hasStyle.md) | ||
* [is](api/wrapper-array/is.md) | ||
* [isEmpty](api/wrapper-array/isEmpty.md) | ||
* [isVueInstance](api/wrapper-array/isVueInstance.md) | ||
* [setComputed](api/wrapper-array/setComputed.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) | ||
* [update](api/wrapper-array/update.md) | ||
* [destroy](api/wrapper-array/destroy.md) | ||
* [components](api/components/README.md) | ||
* [TransitionStub](api/components/TransitionStub.md) | ||
* [TransitionGroupStub](api/components/TransitionGroupStub.md) | ||
* [Seletores](api/selectors.md) | ||
* [createLocalVue](api/createLocalVue.md) | ||
* [config](api/config.md) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
## Índice | ||
|
||
* [Guia](guides/README.md) | ||
* [Iniciando](guides/getting-started.md) | ||
* [Dicas comuns](guides/common-tips.md) | ||
* [Mouse, Tecla e outros eventos do DOM](guides/dom-events.md) | ||
* [Escolhendo um executador de testes](guides/choosing-a-test-runner.md) | ||
* [Testando SFCs com Jest](guides/testing-SFCs-with-jest.md) | ||
* [Testando SFCs com Mocha + webpack](guides/testing-SFCs-with-mocha-webpack.md) | ||
* [Usando com o Vue Router](guides/using-with-vue-router.md) | ||
* [Usando com o Vuex](guides/using-with-vuex.md) | ||
* [API](api/README.md) | ||
* [mount](api/mount.md) | ||
* [shallow](api/shallow.md) | ||
* [Opções de montagem](api/options.md) | ||
- [context](api/options.md#context) | ||
- [slots](api/options.md#slots) | ||
- [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) | ||
- [clone](api/options.md#clone) | ||
* [Wrapper (embrulho)](api/wrapper/README.md) | ||
* [contains](api/wrapper/contains.md) | ||
* [emitted](api/wrapper/emitted.md) | ||
* [emittedByOrder](api/wrapper/emittedByOrder.md) | ||
* [find](api/wrapper/find.md) | ||
* [findAll](api/wrapper/findAll.md) | ||
* [hasAttribute](api/wrapper/hasAttribute.md) | ||
* [hasClass](api/wrapper/hasClass.md) | ||
* [hasProp](api/wrapper/hasProp.md) | ||
* [hasStyle](api/wrapper/hasStyle.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) | ||
* [setComputed](api/wrapper/setComputed.md) | ||
* [setData](api/wrapper/setData.md) | ||
* [setMethods](api/wrapper/setMethods.md) | ||
* [setProps](api/wrapper/setProps.md) | ||
* [text](api/wrapper/text.md) | ||
* [trigger](api/wrapper/trigger.md) | ||
* [update](api/wrapper/update.md) | ||
* [destroy](api/wrapper/destroy.md) | ||
* [WrapperArray](api/wrapper-array/README.md) | ||
* [at](api/wrapper-array/at.md) | ||
* [contains](api/wrapper-array/contains.md) | ||
* [hasAttribute](api/wrapper-array/hasAttribute.md) | ||
* [hasClass](api/wrapper-array/hasClass.md) | ||
* [hasProp](api/wrapper-array/hasProp.md) | ||
* [hasStyle](api/wrapper-array/hasStyle.md) | ||
* [is](api/wrapper-array/is.md) | ||
* [isEmpty](api/wrapper-array/isEmpty.md) | ||
* [isVueInstance](api/wrapper-array/isVueInstance.md) | ||
* [setComputed](api/wrapper-array/setComputed.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) | ||
* [update](api/wrapper-array/update.md) | ||
* [destroy](api/wrapper-array/destroy.md) | ||
* [components](api/components/README.md) | ||
* [TransitionStub](api/components/TransitionStub.md) | ||
* [TransitionGroupStub](api/components/TransitionGroupStub.md) | ||
* [Seletores](api/selectors.md) | ||
* [createLocalVue](api/createLocalVue.md) | ||
* [config](api/config.md) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# API | ||
|
||
* [mount](./mount.md) | ||
* [shallow](./shallow.md) | ||
* [Opções de montagem](./options.md) | ||
- [context](./options.md#context) | ||
- [slots](./options.md#slots) | ||
- [stubs](./options.md#stubs) | ||
- [mocks](./options.md#mocks) | ||
- [localVue](./options.md#localvue) | ||
- [attachToDocument](./options.md#attachtodocument) | ||
- [attrs](./options.md#attrs) | ||
- [listeners](./options.md#listeners) | ||
- [clone](./options.md#clone) | ||
* [Wrapper (embrulho)](./wrapper/README.md) | ||
* [contains](./wrapper/contains.md) | ||
* [emitted](./wrapper/emitted.md) | ||
* [emittedByOrder](./wrapper/emittedByOrder.md) | ||
* [find](./wrapper/find.md) | ||
* [hasAttribute](./wrapper/hasAttribute.md) | ||
* [hasClass](./wrapper/hasClass.md) | ||
* [hasProp](./wrapper/hasProp.md) | ||
* [hasStyle](./wrapper/hasStyle.md) | ||
* [html](./wrapper/html.md) | ||
* [is](./wrapper/is.md) | ||
* [isEmpty](./wrapper/isEmpty.md) | ||
* [isVueInstance](./wrapper/isVueInstance.md) | ||
* [name](./wrapper/name.md) | ||
* [update](./wrapper/update.md) | ||
* [setData](./wrapper/setData.md) | ||
* [setProps](./wrapper/setProps.md) | ||
* [text](./wrapper/text.md) | ||
* [trigger](./wrapper/trigger.md) | ||
* [WrapperArray](./wrapper-array/README.md) | ||
* [at](./wrapper-array/at.md) | ||
* [contains](./wrapper-array/contains.md) | ||
* [hasAttribute](./wrapper-array/hasAttribute.md) | ||
* [hasClass](./wrapper-array/hasClass.md) | ||
* [hasProp](./wrapper-array/hasProp.md) | ||
* [hasStyle](./wrapper-array/hasStyle.md) | ||
* [is](./wrapper-array/is.md) | ||
* [isEmpty](./wrapper-array/isEmpty.md) | ||
* [isVueInstance](./wrapper-array/isVueInstance.md) | ||
* [update](./wrapper-array/update.md) | ||
* [setData](./wrapper-array/setData.md) | ||
* [setProps](./wrapper-array/setProps.md) | ||
* [trigger](./wrapper-array/trigger.md) | ||
* [createLocalVue](./createLocalVue.md) | ||
* [Seletores](./selectors.md) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Componentes | ||
|
||
O vue-test-utils apresenta alguns componentes utilitários para que você possa esboçar componentes. | ||
|
||
O [TransitionStub](./TransitionStub.md) e o [TransitionGroupStub](./TransitionGroupStub.md) por padrão são usados para esboçar componentes de transições e grupo de transições. Mas você pode editar esses esboços editando as configurações do mesmo. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# TransitionGroupStub (Esboço de grupo de transições) | ||
|
||
É um componente para substituir o componente `transition-group`. Em vez de executar as transições do grupo de forma assíncrona, ele retorna os componentes filhos de forma síncrona. | ||
|
||
Por padrão é configurado para trocar todos os componentes `transitions-group` da sua aplicação. Para desativar o componente `transition-group`, passe `config.stubs['transition-group']` para false: | ||
|
||
```js | ||
import VueTestUtils from 'vue-test-utils' | ||
|
||
VueTestUtils.config.stubs['transition-group'] = false | ||
``` | ||
|
||
Para redefinir os grupos de transições no stub, use: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Já que o termo |
||
|
||
```js | ||
import VueTestUtils, { TransitionGroupStub } from 'vue-test-utils' | ||
|
||
VueTestUtils.config.stubs['transition-group'] = TransitionGroupStub | ||
``` | ||
|
||
Para configura-lo na montagem, use: | ||
|
||
```js | ||
import { mount, TransitionGroupStub } from 'vue-test-utils' | ||
|
||
mount(Component, { | ||
stubs: { | ||
'transition-group': TransitionGroupStub | ||
} | ||
}) | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# TransitionStub (esboço de transição) | ||
|
||
É um componente para substituir o componente `transition`. Em vez de executar as transições de forma assíncrona, ele retorna o componente filho de forma síncrona. | ||
|
||
Por padrão é configurado para trocar todos os componentes `transitions` da sua aplicação. Para desativar o componente `transition`, passe `config.stubs.transition` para false: | ||
|
||
```js | ||
import VueTestUtils from 'vue-test-utils' | ||
|
||
VueTestUtils.config.stubs.transition = false | ||
``` | ||
|
||
Para redefini-lo como componente de transição, use: | ||
|
||
```js | ||
import VueTestUtils, { TransitionStub } from 'vue-test-utils' | ||
|
||
VueTestUtils.config.stubs.transition = TransitionStub | ||
``` | ||
|
||
Para configura-lo como um stub nas opções de montagem, use: | ||
|
||
```js | ||
import { mount, TransitionStub } from 'vue-test-utils' | ||
|
||
mount(Component, { | ||
stubs: { | ||
transition: TransitionStub | ||
} | ||
}) | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Configurações | ||
|
||
O vue-test-utils apresenta um objeto de configuração para que você possa definir as opções usadas no wrapper. | ||
|
||
## Opções de configurações do `vue-test-utils | ||
|
||
### `stubs` | ||
|
||
- tipo: `Object` | ||
- padrão: `{ | ||
transition: TransitionStub, | ||
'transition-group': TransitionGroupStub | ||
}` | ||
|
||
Esboços são usados em todos componentes. Eles são substituídos pelos `stubs` passados nas opções da montagem. | ||
|
||
Quando você passa os `stubs` como um array de string nas opções de montagens, o `config.stubs` é convertido em um array e os componentes são esboçados com um componente que retorna uma div. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Na tradução da documentação oficial do Vue, padronizamos tipos de dados sempre com letras maiúsculas (assim como é inerente ao JavaScript), portanto todas as ocasiões em que o texto fala de Array, String, Boolean, Number e Object idealmente seriam grafadas em maiúsculo para manter a padronização com o restante da documentação brasileira. |
||
|
||
Exemplho: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Erro de digitação. |
||
|
||
```js | ||
import VueTestUtils from 'vue-test-utils' | ||
|
||
VueTestUtils.config.stubs['meu-componente'] = '<div />' | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# createLocalVue() | ||
|
||
- **Retorna:** | ||
- `{Component}` | ||
|
||
- **Uso:** | ||
|
||
O `createLocalVue` retorna uma classe do Vue para que você possa adicionar componentes, mixins e plugins sem poluir sua classe global do Vue. | ||
|
||
Usando com o `options.localVue` | ||
|
||
```js | ||
import { createLocalVue, shallow } from 'vue-test-utils' | ||
import { expect } from 'chai' | ||
import Foo from './Foo.vue' | ||
|
||
const localVue = createLocalVue() | ||
const wrapper = shallow(Foo, { | ||
localVue, | ||
mocks: { foo: true } | ||
}) | ||
|
||
expect(wrapper.vm.foo).toBe(true) | ||
|
||
const wrapperSemMock = shallow(Foo) | ||
|
||
expect(wrapperSemMock.vm.foo).toBe(false) | ||
``` | ||
|
||
- **Veja também:** [Dicas comuns](../guides/common-tips.md#applying-global-plugins-and-mixins) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Não vejo necessidade na tradução do termo Wrapper, visto que estamos falando de um padrão de nomenclatura bem consolidado e que desenvolvedores brasileiros também usam frequentemente.