From c85961398489262452b5c86797caaed201c9a130 Mon Sep 17 00:00:00 2001 From: Jinjiang Date: Thu, 19 Oct 2017 15:14:25 +0800 Subject: [PATCH 1/8] [en] typo --- docs/en/api/README.md | 7 +++++-- docs/en/guides/getting-started.md | 10 +++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/docs/en/api/README.md b/docs/en/api/README.md index 231254061..8edbd1bdb 100644 --- a/docs/en/api/README.md +++ b/docs/en/api/README.md @@ -17,6 +17,7 @@ * [emitted](./wrapper/emitted.md) * [emittedByOrder](./wrapper/emittedByOrder.md) * [find](./wrapper/find.md) + * [findAll](./wrapper/findAll.md) * [hasAttribute](./wrapper/hasAttribute.md) * [hasClass](./wrapper/hasClass.md) * [hasProp](./wrapper/hasProp.md) @@ -31,6 +32,7 @@ * [setProps](./wrapper/setProps.md) * [text](./wrapper/text.md) * [trigger](./wrapper/trigger.md) + * [update](./wrapper/update.md) * [WrapperArray](./wrapper-array/README.md) * [at](./wrapper-array/at.md) * [contains](./wrapper-array/contains.md) @@ -41,9 +43,10 @@ * [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) + * [setMethods](./wrapper-array/setMethods.md) * [setProps](./wrapper-array/setProps.md) * [trigger](./wrapper-array/trigger.md) -* [createLocalVue](./createLocalVue.md) + * [update](./wrapper-array/update.md) * [Selectors](./selectors.md) +* [createLocalVue](./createLocalVue.md) diff --git a/docs/en/guides/getting-started.md b/docs/en/guides/getting-started.md index 5c023d6dc..ad024164f 100644 --- a/docs/en/guides/getting-started.md +++ b/docs/en/guides/getting-started.md @@ -48,7 +48,7 @@ You can create wrappers using the `mount` method. Let's create a file called `te ```js // test.js -// Import the mount() method from the test utils +// Import the `mount()` method from the test utils // and the component you want to test import { mount } from 'vue-test-utils' import Counter from './counter' @@ -56,11 +56,11 @@ import Counter from './counter' // Now mount the component and you have the wrapper const wrapper = mount(Counter) -// You can access the actual Vue instance via wrapper.vm +// You can access the actual Vue instance via `wrapper.vm` const vm = wrapper.vm // To inspect the wrapper deeper just log it to the console -// and your adventure with the vue-test-utils begins +// and your adventure with the `vue-test-utils` begins console.log(wrapper) ``` @@ -112,5 +112,5 @@ To simplify usage, `vue-test-utils` applies all updates synchronously so you don ## What's Next -- Integrate `vue-test-utils` into your project by [choosing a test runner](./choosing-a-test-runner.md) -- Learn more about [common techniques when writing tests](./common-tips.md) +- Integrate `vue-test-utils` into your project by [choosing a test runner](./choosing-a-test-runner.md). +- Learn more about [common techniques when writing tests](./common-tips.md). From f643e403dd3eec9a72d26a61343f40fddd2e5f8b Mon Sep 17 00:00:00 2001 From: Jinjiang Date: Fri, 20 Oct 2017 16:29:20 +0800 Subject: [PATCH 2/8] typo --- docs/en/guides/common-tips.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/en/guides/common-tips.md b/docs/en/guides/common-tips.md index abd7500a7..0ff8b4c15 100644 --- a/docs/en/guides/common-tips.md +++ b/docs/en/guides/common-tips.md @@ -6,7 +6,7 @@ For UI components, we don't recommend aiming for complete line-based coverage, b Instead, we recommend writing tests that assert your component's public interface, and treat its internals as a black box. A single test case would assert that some input (user interaction or change of props) provided to the component results in the expected output (render result or emitted custom events). -For example, for the `Counter` component which increments a display counter by 1 each time a button is clicked, its test case would simulate the click and assert that the rendered output has increased by 1. The test doesn't care about how the Counter increments the value, it only cares about the input and the output. +For example, for the `Counter` component which increments a display counter by 1 each time a button is clicked, its test case would simulate the click and assert that the rendered output has increased by 1. The test doesn't care about how the `Counter` increments the value, it only cares about the input and the output. The benefit of this approach is that as long as your component's public interface remains the same, your tests will pass no matter how the component's internal implementation changes over time. @@ -36,7 +36,7 @@ wrapper.vm.$emit('foo') wrapper.vm.$emit('foo', 123) /* -wrapper.emitted() returns the following object: +`wrapper.emitted()` returns the following object: { foo: [[], [123]] } @@ -58,7 +58,7 @@ expect(wrapper.emitted().foo.length).toBe(2) expect(wrapper.emitted().foo[1]).toEqual([123]) ``` -You can also get an Array of the events in their emit order by calling [wrapper.emittedByOrder()](../api/wrapper/emittedByOrder.md). +You can also get an Array of the events in their emit order by calling [`wrapper.emittedByOrder()`](../api/wrapper/emittedByOrder.md). ## Manipulating Component State @@ -92,18 +92,18 @@ You can also update the props of an already-mounted component with the `wrapper. Some of the components may rely on features injected by a global plugin or mixin, for example `vuex` and `vue-router`. -If you are writing tests for components in a specific app, you can setup the same global plugins and mixins once in the entry of your tests. But in some cases, for example testing a generic component suite that may get shared across different apps, it's better to test your components in a more isolated setup, without polluting the global `Vue` constructor. We can use the [createLocalVue](../api/createLocalVue.md) method to achieve that: +If you are writing tests for components in a specific app, you can setup the same global plugins and mixins once in the entry of your tests. But in some cases, for example testing a generic component suite that may get shared across different apps, it's better to test your components in a more isolated setup, without polluting the global `Vue` constructor. We can use the [`createLocalVue`](../api/createLocalVue.md) method to achieve that: ``` js import createLocalVue from 'vue-test-utils' -// create an extended Vue constructor +// create an extended `Vue` constructor const localVue = createLocalVue() // install plugins as normal localVue.use(MyPlugin) -// pass the localVue to the mount options +// pass the `localVue` to the mount options mount(Component, { localVue }) @@ -111,7 +111,7 @@ mount(Component, { ## Mocking Injections -Another strategy for injected properties is simply mocking them. You can do that with the `mocks` option: +Another strategy for injected props is simply mocking them. You can do that with the `mocks` option: ```js import { mount } from 'vue-test-utils' @@ -125,7 +125,7 @@ const $route = { mount(Component, { mocks: { - $route // adds the mocked $route object to the Vue instance before mounting component + $route // adds the mocked `$route` object to the Vue instance before mounting component } }) ``` From fbe2e7d5b5e57e0be7c166da4f6dba3425b47b09 Mon Sep 17 00:00:00 2001 From: Jinjiang Date: Sun, 29 Oct 2017 00:03:11 +0800 Subject: [PATCH 3/8] typo --- docs/en/api/createLocalVue.md | 4 +- docs/en/api/mount.md | 5 ++- docs/en/api/options.md | 24 ++++++------ docs/en/api/selectors.md | 24 ++++++------ docs/en/api/shallow.md | 2 +- docs/en/api/wrapper-array/README.md | 4 +- docs/en/api/wrapper/README.md | 10 ++--- docs/en/api/wrapper/contains.md | 2 +- docs/en/api/wrapper/hasClass.md | 2 +- docs/en/api/wrapper/hasStyle.md | 2 +- docs/en/api/wrapper/trigger.md | 4 +- docs/en/guides/choosing-a-test-runner.md | 2 +- docs/en/guides/testing-SFCs-with-jest.md | 11 +++--- .../guides/testing-SFCs-with-mocha-webpack.md | 6 +-- docs/en/guides/using-with-vuex.md | 38 ++++++++++--------- 15 files changed, 72 insertions(+), 68 deletions(-) diff --git a/docs/en/api/createLocalVue.md b/docs/en/api/createLocalVue.md index a3cbfcee3..b6d07aae9 100644 --- a/docs/en/api/createLocalVue.md +++ b/docs/en/api/createLocalVue.md @@ -1,4 +1,4 @@ -# createLocalVue() +# `createLocalVue()` - **Returns:** - `{Component}` @@ -7,7 +7,7 @@ `createLocalVue` returns a Vue class for you to add components, mixins and install plugins without polluting the global Vue class. -Use it with `options.localVue` +Use it with `options.localVue`: ```js import { createLocalVue, shallow } from 'vue-test-utils' diff --git a/docs/en/api/mount.md b/docs/en/api/mount.md index aaddd3e2f..84b12362a 100644 --- a/docs/en/api/mount.md +++ b/docs/en/api/mount.md @@ -1,4 +1,4 @@ -# mount(component {, options}]) +# `mount(component {, options}])` - **Arguments:** @@ -31,6 +31,7 @@ describe('Foo', () => { }) }) ``` + **With Vue options:** ```js @@ -80,7 +81,7 @@ describe('Foo', () => { const wrapper = mount(Foo, { slots: { default: [Bar, FooBar], - fooBar: FooBar, // Will match , + fooBar: FooBar, // Will match ``. foo: '
' } }) diff --git a/docs/en/api/options.md b/docs/en/api/options.md index 862992dae..cb2d6f6ed 100644 --- a/docs/en/api/options.md +++ b/docs/en/api/options.md @@ -6,15 +6,15 @@ Vue options are passed to the component when a new instance is created. , e.g. ` ## `vue-test-utils` Specific Mounting Options -- [context](#context) -- [slots](#slots) -- [stubs](#stubs) -- [mocks](#mocks) -- [localVue](#localvue) -- [attachToDocument](#attachtodocument) -- [attrs](#attrs) -- [listeners](#listeners) -- [clone](#clone) +- [`context`](#context) +- [`slots`](#slots) +- [`stubs`](#stubs) +- [`mocks`](#mocks) +- [`localVue`](#localvue) +- [`attachToDocument`](#attachtodocument) +- [`attrs`](#attrs) +- [`listeners`](#listeners) +- [`clone`](#clone) ### `context` @@ -50,7 +50,7 @@ import Bar from './Bar.vue' const wrapper = shallow(Component, { slots: { default: [Foo, Bar], - fooBar: Foo, // Will match , + fooBar: Foo, // Will match ``. foo: '
' } }) @@ -106,7 +106,7 @@ expect(wrapper.vm.$route.path).toBe($route.path) - type: `Vue` -A local copy of Vue created by [createLocalVue](./createLocalVue.md) to use when mounting the component. Installing plugins on this copy of Vue prevents polluting the original `Vue` copy. +A local copy of Vue created by [`createLocalVue`](./createLocalVue.md) to use when mounting the component. Installing plugins on this copy of `Vue` prevents polluting the original `Vue` copy. Example: @@ -162,4 +162,4 @@ Clones component before mounting if `true`, which avoids mutating the original c `options.mocks` (`Object`): Add globals to Vue instance. -`options.localVue` (`Object`): vue class to use in `mount`. See [createLocalVue](createLocalVue.md) +`options.localVue` (`Object`): `Vue` class to use in `mount`. See [`createLocalVue`](createLocalVue.md). diff --git a/docs/en/api/selectors.md b/docs/en/api/selectors.md index 5ab5c426c..68512d8cb 100644 --- a/docs/en/api/selectors.md +++ b/docs/en/api/selectors.md @@ -4,31 +4,31 @@ A lot of methods take a selector as an argument. A selector can either be a CSS ## CSS Selectors -mount handles any valid CSS selector: +Mount handles any valid CSS selector: -- tag selectors (div, foo, bar) -- class selectors (.foo, .bar) -- attribute selectors ([foo], [foo="bar"]) -- id selectors (#foo, #bar) -- pseudo selectors (div:first-of-type) +- tag selectors (`div`, `foo`, `bar`) +- class selectors (`.foo`, `.bar`) +- attribute selectors (`[foo]`, `[foo="bar"]`) +- id selectors (`#foo`, `#bar`) +- pseudo selectors (`div:first-of-type`) You can also use combinators: -- direct descendant combinator (div > #bar > .foo) -- general descendant combinator (div #bar .foo) -- adjacent sibling selector (div + .foo) -- general sibling selector (div ~ .foo) +- direct descendant combinator (`div > #bar > .foo`) +- general descendant combinator (`div #bar .foo`) +- adjacent sibling selector (`div + .foo`) +- general sibling selector (`div ~ .foo`) ## Vue Components Vue components are also valid selectors. -vue-test-utils uses the `name` property to search the instance tree for matching Vue components. +`vue-test-utils` uses the `name` property to search the instance tree for matching Vue components. ```js // Foo.vue -export default{ +export default { name: 'FooComponent' } ``` diff --git a/docs/en/api/shallow.md b/docs/en/api/shallow.md index fa16e9d24..bda43e09a 100644 --- a/docs/en/api/shallow.md +++ b/docs/en/api/shallow.md @@ -1,4 +1,4 @@ -# shallow(component {, options}]) +# `shallow(component {, options}])` - **Arguments:** diff --git a/docs/en/api/wrapper-array/README.md b/docs/en/api/wrapper-array/README.md index 2a6d40ccc..e23be091e 100644 --- a/docs/en/api/wrapper-array/README.md +++ b/docs/en/api/wrapper-array/README.md @@ -1,6 +1,6 @@ # WrapperArray -A `WrapperArray` is an object that contains an array of [Wrappers](../wrapper/README.md), and methods to test the `Wrappers`. +A `WrapperArray` is an object that contains an array of [`Wrappers`](../wrapper/README.md), and methods to test the `Wrappers`. - **Properties:** @@ -8,4 +8,4 @@ A `WrapperArray` is an object that contains an array of [Wrappers](../wrapper/RE - **Methods:** -There is a detailed list of methods in the WrapperArray section of the docs. +There is a detailed list of methods in the `WrapperArray` section of the docs. diff --git a/docs/en/api/wrapper/README.md b/docs/en/api/wrapper/README.md index 6469b8745..171ba0aa9 100644 --- a/docs/en/api/wrapper/README.md +++ b/docs/en/api/wrapper/README.md @@ -1,15 +1,15 @@ -# Wrapper +# `Wrapper` -vue-test-utils is a wrapper based API. +`vue-test-utils` is a wrapper based API. A `Wrapper` is an object that contains a mounted component or vnode and methods to test the component or vnode. - **Properties:** -`vm` `Component`: this is the vue instance. You can access all the [instance methods and properties of a vm](https://vuejs.org/v2/api/#Instance-Properties) with `wrapper.vm`. This only exists on Vue component wrappers +`vm` `Component`: this is the `Vue` instance. You can access all the [instance methods and properties of a vm](https://vuejs.org/v2/api/#Instance-Properties) with `wrapper.vm`. This only exists on Vue component wrappers `element` `HTMLElement`: the root DOM node of the wrapper -`options` `Object`: Object containing vue-test-utils options passed to `mount` or `shallow` -`options.attachedToDom` `Boolean`: True if attachToDom was passed to `mount` or `shallow` +`options` `Object`: Object containing `vue-test-utils` options passed to `mount` or `shallow` +`options.attachedToDom` `Boolean`: True if `attachToDom` was passed to `mount` or `shallow` - **Methods:** diff --git a/docs/en/api/wrapper/contains.md b/docs/en/api/wrapper/contains.md index a91b0353b..98a13b920 100644 --- a/docs/en/api/wrapper/contains.md +++ b/docs/en/api/wrapper/contains.md @@ -1,4 +1,4 @@ -# contains(selector) +# `contains(selector)` Assert `Wrapper` contains an element or component matching [selector](../selectors.md). diff --git a/docs/en/api/wrapper/hasClass.md b/docs/en/api/wrapper/hasClass.md index c70b21ef9..8f578bd24 100644 --- a/docs/en/api/wrapper/hasClass.md +++ b/docs/en/api/wrapper/hasClass.md @@ -2,7 +2,7 @@ Assert `Wrapper` DOM node has class contains `className`. -Returns `true` if `Wrapper` DOM node contains class. +Returns `true` if `Wrapper` DOM node contains the class. - **Arguments:** - `{string} className` diff --git a/docs/en/api/wrapper/hasStyle.md b/docs/en/api/wrapper/hasStyle.md index 0281d8401..a9122f983 100644 --- a/docs/en/api/wrapper/hasStyle.md +++ b/docs/en/api/wrapper/hasStyle.md @@ -1,6 +1,6 @@ # hasStyle(style, value) -Assert `Wrapper` DOM node has style matching value +Assert `Wrapper` DOM node has style matching value. Returns `true` if `Wrapper` DOM node has `style` matching `value`. diff --git a/docs/en/api/wrapper/trigger.md b/docs/en/api/wrapper/trigger.md index 537cda9e6..c830963bd 100644 --- a/docs/en/api/wrapper/trigger.md +++ b/docs/en/api/wrapper/trigger.md @@ -2,9 +2,9 @@ Triggers an event on the `Wrapper` DOM node. -Trigger takes an optional `options` object. The properties in the `options` object are added to the Event. +`trigger` takes an optional `options` object. The properties in the `options` object are added to the Event. -You can run preventDefault on the event by passing `preventDefault: true` in `options`. +You can run `preventDefault` on the event by passing `preventDefault: true` in `options`. - **Arguments:** - `{string} eventName` diff --git a/docs/en/guides/choosing-a-test-runner.md b/docs/en/guides/choosing-a-test-runner.md index 8d69377b1..b803c8196 100644 --- a/docs/en/guides/choosing-a-test-runner.md +++ b/docs/en/guides/choosing-a-test-runner.md @@ -12,7 +12,7 @@ There are a few things to consider when choosing a test runner though: feature s ## Browser Environment -`vue-test-utils` relies on a browser environment. Technically you can run it in a real browser, but it's not recommended due to the complexity of launching real browsers on different platforms. Instead, we recommend running the tests in Node.js with a virtual browser environment using [JSDOM](https://github.com/tmpvar/jsdom). +`vue-test-utils` relies on a browser environment. Technically you can run it in a real browser, but it's not recommended due to the complexity of launching real browsers on different platforms. Instead, we recommend running the tests in Node with a virtual browser environment using [JSDOM](https://github.com/tmpvar/jsdom). The Jest test runner sets up JSDOM automatically. For other test runners, you can manually set up JSDOM for the tests using [jsdom-global](https://github.com/rstacruz/jsdom-global) in the entry for your tests: diff --git a/docs/en/guides/testing-SFCs-with-jest.md b/docs/en/guides/testing-SFCs-with-jest.md index 100544d2d..838a6ae02 100644 --- a/docs/en/guides/testing-SFCs-with-jest.md +++ b/docs/en/guides/testing-SFCs-with-jest.md @@ -42,12 +42,12 @@ Next, create a `jest` block in `package.json`: "moduleFileExtensions": [ "js", "json", - // tell Jest to handle *.vue files + // tell Jest to handle `*.vue` files "vue" ], "transform": { - // process *.vue files with vue-jest - ".*\\.(vue)$": "/node_modules/vue-jest" + // process `*.vue` files with `jest-vue` + ".*\\.(vue)$": "/node_modules/jest-vue" }, "mapCoverage": true } @@ -75,6 +75,7 @@ If you use a resolve alias in the webpack config, e.g. aliasing `@` to `/src`, y ## Configuring Babel for Jest + Although latest versions of Node already supports most ES2015 features, you may still want to use ES modules syntax and stage-x features in your tests. For that we need to install `babel-jest`: ``` bash @@ -90,7 +91,7 @@ Next, we need to tell Jest to process JavaScript test files with `babel-jest` by // ... "transform": { // ... - // process js with babel-jest + // process js with `babel-jest` "^.+\\.js$": "/node_modules/babel-jest" }, // ... @@ -150,7 +151,7 @@ Then configure it in `package.json`: ### Placing Test Files -By default, Jest will recursively pick up all files that have a `.spec.js` or `.test.js` extension in the entire project. If this does not fit your needs, it's possible [to change the testRegex](https://facebook.github.io/jest/docs/en/configuration.html#testregex-string) in the config section in the `package.json` file. +By default, Jest will recursively pick up all files that have a `.spec.js` or `.test.js` extension in the entire project. If this does not fit your needs, it's possible [to change the `testRegex`](https://facebook.github.io/jest/docs/en/configuration.html#testregex-string) in the config section in the `package.json` file. Jest recommends creating a `__tests__` directory right next to the code being tested, but feel free to structure your tests as you see fit. Just beware that Jest would create a `__snapshots__` directory next to test files that performs snapshot testing. diff --git a/docs/en/guides/testing-SFCs-with-mocha-webpack.md b/docs/en/guides/testing-SFCs-with-mocha-webpack.md index f7013a015..fc79e6453 100644 --- a/docs/en/guides/testing-SFCs-with-mocha-webpack.md +++ b/docs/en/guides/testing-SFCs-with-mocha-webpack.md @@ -78,7 +78,7 @@ module.exports = { ### Setting Up Browser Environment -`vue-test-utils` requires a browser environment to run. We can simulate it in Node.js using `jsdom-global`: +`vue-test-utils` requires a browser environment to run. We can simulate it in Node using `jsdom-global`: ```bash npm install --save-dev jsdom jsdom-global @@ -90,7 +90,7 @@ Then in `test/setup.js`: require('jsdom-global')() ``` -This adds a browser environment to node, so that `vue-test-utils` can run correctly. +This adds a browser environment to Node, so that `vue-test-utils` can run correctly. ### Picking an Assertion Library @@ -116,7 +116,7 @@ global.expect = require('expect') Notice that we are using `babel-loader` to handle JavaScript. You should already have Babel configured if you are using it in your app via a `.babelrc` file. Here `babel-loader` will automatically use the same config file. -One thing to note is that if you are using Node 6+, which already supports the majority of ES2015 features, you can configure a separate Babel [env option](https://babeljs.io/docs/usage/babelrc/#env-option) that only transpiles features that are not already supported in the Node version you are using (e.g. `stage-2` or flow syntax support, etc.) +One thing to note is that if you are using Node 6+, which already supports the majority of ES2015 features, you can configure a separate Babel [env option](https://babeljs.io/docs/usage/babelrc/#env-option) that only transpiles features that are not already supported in the Node version you are using (e.g. `stage-2` or flow syntax support, etc.). ### Adding a test diff --git a/docs/en/guides/using-with-vuex.md b/docs/en/guides/using-with-vuex.md index 85f40d7fd..9ed2841b7 100644 --- a/docs/en/guides/using-with-vuex.md +++ b/docs/en/guides/using-with-vuex.md @@ -10,10 +10,10 @@ This is the component we want to test. It calls Vuex actions. ``` html ``` + Simple component that includes one action and one getter. And the test: @@ -242,14 +244,14 @@ describe('Modules.vue', () => { }) }) - it('calls store action moduleActionClick when button is clicked', () => { + it('calls store action "moduleActionClick" when button is clicked', () => { const wrapper = shallow(Modules, { store, localVue }) const button = wrapper.find('button') button.trigger('click') expect(actions.moduleActionClick).toHaveBeenCalled() }) - it('Renders state.inputValue in first p tag', () => { + it('Renders "state.inputValue" in first p tag', () => { const wrapper = shallow(Modules, { store, localVue }) const p = wrapper.find('p') expect(p.text()).toBe(state.module.clicks.toString()) @@ -260,5 +262,5 @@ describe('Modules.vue', () => { ### Resources - [Example project for this guide](https://github.com/eddyerburgh/vue-test-utils-vuex-example) -- [localVue](../api/options.md#localvue) -- [createLocalVue](../api/createLocalVue.md) +- [`localVue`](../api/options.md#localvue) +- [`createLocalVue`](../api/createLocalVue.md) From e465c0b586cf2b76c65a17b48913218a2cf5460b Mon Sep 17 00:00:00 2001 From: Jinjiang Date: Sun, 29 Oct 2017 00:03:11 +0800 Subject: [PATCH 4/8] [en] typo From 6c1fa5a8061307ac25e92d7500a458c922fc6d3b Mon Sep 17 00:00:00 2001 From: Jinjiang Date: Mon, 6 Nov 2017 14:17:40 +0800 Subject: [PATCH 5/8] [en] updated contents --- docs/en/api/README.md | 4 +++- docs/en/api/wrapper-array/destroy.md | 1 - docs/en/guides/README.md | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/en/api/README.md b/docs/en/api/README.md index 8edbd1bdb..b66159f04 100644 --- a/docs/en/api/README.md +++ b/docs/en/api/README.md @@ -27,12 +27,13 @@ * [isEmpty](./wrapper/isEmpty.md) * [isVueInstance](./wrapper/isVueInstance.md) * [name](./wrapper/name.md) - * [update](./wrapper/update.md) * [setData](./wrapper/setData.md) + * [setMethods](./wrapper/setMethods.md) * [setProps](./wrapper/setProps.md) * [text](./wrapper/text.md) * [trigger](./wrapper/trigger.md) * [update](./wrapper/update.md) + * [destroy](./wrapper/destroy.md) * [WrapperArray](./wrapper-array/README.md) * [at](./wrapper-array/at.md) * [contains](./wrapper-array/contains.md) @@ -48,5 +49,6 @@ * [setProps](./wrapper-array/setProps.md) * [trigger](./wrapper-array/trigger.md) * [update](./wrapper-array/update.md) + * [destroy](./wrapper-array/destroy.md) * [Selectors](./selectors.md) * [createLocalVue](./createLocalVue.md) diff --git a/docs/en/api/wrapper-array/destroy.md b/docs/en/api/wrapper-array/destroy.md index 875936ecb..13eb16ebd 100644 --- a/docs/en/api/wrapper-array/destroy.md +++ b/docs/en/api/wrapper-array/destroy.md @@ -14,5 +14,4 @@ const divArray = wrapper.findAll('div') expect(divArray.contains('p')).toBe(true) divArray.destroy() expect(divArray.contains('p')).toBe(false) - ``` diff --git a/docs/en/guides/README.md b/docs/en/guides/README.md index b347c3734..8b6b6a4f7 100644 --- a/docs/en/guides/README.md +++ b/docs/en/guides/README.md @@ -2,6 +2,7 @@ * [Getting Started](./getting-started.md) * [Common Tips](./common-tips.md) +* [Mouse, Key and other DOM Events](./dom-events.md) * [Choosing a test runner](./choosing-a-test-runner.md) * [Using with Jest](./using-with-jest.md) * [Testing SFCs with Jest](./testing-SFCs-with-jest.md) From f96b322cc7a7f99e334ac60c934d0dcdd65475ce Mon Sep 17 00:00:00 2001 From: Jinjiang Date: Sat, 11 Nov 2017 23:29:03 +0800 Subject: [PATCH 6/8] typo --- docs/en/guides/dom-events.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/en/guides/dom-events.md b/docs/en/guides/dom-events.md index 091096874..36b2c7957 100644 --- a/docs/en/guides/dom-events.md +++ b/docs/en/guides/dom-events.md @@ -22,7 +22,7 @@ wrapper.find('button').trigger('click') The trigger method takes an optional `options` object. The properties in the `options` object are added to the Event. -You can run preventDefault on the event by passing `preventDefault: true` in `options`. +You can run `preventDefault` on the event by passing `preventDefault: true` in `options`. ```js const wrapper = mount(MyButton) @@ -189,8 +189,8 @@ describe('Key event tests', () => { A key name after the dot `keydown.up` is translated to a `keyCode`. This is supported for the following names: -* enter, tab, delete, esc, space, up, down, left, right +* `enter`, `tab`, `delete`, `esc`, `space`, `up`, `down`, `left`, `right` ## Important -vue-test-utils triggers event synchronously. Consequently, `Vue.nextTick` is not required. +`vue-test-utils` triggers event synchronously. Consequently, `Vue.nextTick` is not required. From 309032d7266fd34dfd9d8dc186b20ed04275947d Mon Sep 17 00:00:00 2001 From: Jinjiang Date: Mon, 20 Nov 2017 11:44:34 +0800 Subject: [PATCH 7/8] [en] typo + format --- docs/en/api/README.md | 6 +++++- docs/en/api/components/TransitionGroupStub.md | 5 +++-- docs/en/api/selectors.md | 2 +- docs/en/api/wrapper-array/setComputed.md | 2 +- docs/en/api/wrapper/setComputed.md | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/en/api/README.md b/docs/en/api/README.md index b66159f04..43ea7b49a 100644 --- a/docs/en/api/README.md +++ b/docs/en/api/README.md @@ -50,5 +50,9 @@ * [trigger](./wrapper-array/trigger.md) * [update](./wrapper-array/update.md) * [destroy](./wrapper-array/destroy.md) -* [Selectors](./selectors.md) +* [components](./components/README.md) + * [TransitionStub](./components/TransitionStub.md) + * [TransitionGroupStub](./components/TransitionGroupStub.md) * [createLocalVue](./createLocalVue.md) +* [Selectors](./selectors.md) +* [config](./config.md) diff --git a/docs/en/api/components/TransitionGroupStub.md b/docs/en/api/components/TransitionGroupStub.md index f7061f5c3..ef66d9f72 100644 --- a/docs/en/api/components/TransitionGroupStub.md +++ b/docs/en/api/components/TransitionGroupStub.md @@ -2,15 +2,16 @@ A component to stub the `transition-group` wrapper component. Instead of performing transitions asynchronously, it returns the child components synchronously. -This is set to stub all `transition-group` components by default in the vue-test-utils config. To use the built-in `transition-group` wrapper component set `config.stubs[transition-group]` to false: +This is set to stub all `transition-group` components by default in the `vue-test-utils` config. To use the built-in `transition-group` wrapper component set `config.stubs['transition-group']` to false: ```js import VueTestUtils from 'vue-test-utils' -VueTestUtils.config.stubs.transition = false +VueTestUtils.config.stubs['transition-group'] = false ``` To reset it to stub transition components: + ```js import VueTestUtils, { TransitionGroupStub } from 'vue-test-utils' diff --git a/docs/en/api/selectors.md b/docs/en/api/selectors.md index 68512d8cb..a47a56e38 100644 --- a/docs/en/api/selectors.md +++ b/docs/en/api/selectors.md @@ -46,7 +46,7 @@ expect(wrapper.is(Foo)).toBe(true) ### Ref -Using a find option object, vue-test-utils allows for selecting elements by $ref on wrapper components. +Using a find option object, `vue-test-utils` allows for selecting elements by `$ref` on wrapper components. ```js const buttonWrapper = wrapper.find({ ref: 'myButton' }); diff --git a/docs/en/api/wrapper-array/setComputed.md b/docs/en/api/wrapper-array/setComputed.md index 7531132cf..35d2dcce4 100644 --- a/docs/en/api/wrapper-array/setComputed.md +++ b/docs/en/api/wrapper-array/setComputed.md @@ -4,7 +4,7 @@ Sets `Wrapper` `vm` computed and forces update on each `Wrapper` in `WrapperArray`. **Note every `Wrapper` must contain a Vue instance.** -**Note every Vue instance must already have the computed properties passed to setComputed.** +**Note every Vue instance must already have the computed properties passed to `setComputed`.** - **Arguments:** - `{Object} computed properties` diff --git a/docs/en/api/wrapper/setComputed.md b/docs/en/api/wrapper/setComputed.md index b5db5549e..132a2d509 100644 --- a/docs/en/api/wrapper/setComputed.md +++ b/docs/en/api/wrapper/setComputed.md @@ -3,7 +3,7 @@ Sets `Wrapper` `vm` computed property and forces update. **Note the Wrapper must contain a Vue instance.** -**Note every Vue instance must already have the computed properties passed to setComputed.** +**Note the Vue instance must already have the computed properties passed to `setComputed`.** - **Arguments:** From 810180d3ab25019fa6677fcb4b606286080dd59c Mon Sep 17 00:00:00 2001 From: Jinjiang Date: Mon, 20 Nov 2017 12:13:17 +0800 Subject: [PATCH 8/8] [en] typo --- docs/en/api/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/en/api/README.md b/docs/en/api/README.md index 43ea7b49a..c48a26180 100644 --- a/docs/en/api/README.md +++ b/docs/en/api/README.md @@ -27,6 +27,7 @@ * [isEmpty](./wrapper/isEmpty.md) * [isVueInstance](./wrapper/isVueInstance.md) * [name](./wrapper/name.md) + * [setComputed](./wrapper/setComputed.md) * [setData](./wrapper/setData.md) * [setMethods](./wrapper/setMethods.md) * [setProps](./wrapper/setProps.md) @@ -44,6 +45,7 @@ * [is](./wrapper-array/is.md) * [isEmpty](./wrapper-array/isEmpty.md) * [isVueInstance](./wrapper-array/isVueInstance.md) + * [setComputed](./wrapper-array/setComputed.md) * [setData](./wrapper-array/setData.md) * [setMethods](./wrapper-array/setMethods.md) * [setProps](./wrapper-array/setProps.md)