Skip to content

Commit

Permalink
chore: format code with Prettier (#1111)
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyerburgh authored Jan 26, 2019
1 parent ade4398 commit be4033e
Show file tree
Hide file tree
Showing 326 changed files with 3,004 additions and 3,157 deletions.
4 changes: 3 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
"rules": {
"no-debugger": 2,
"no-proto": 0,
"max-len": 2
"space-before-function-paren": 0,
"object-curly-spacing": 0,
"indent": 0
}
}
8 changes: 5 additions & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Hi! I’m really excited that you are interested in contributing to Vue Test Uti
- Make sure `npm test` passes. (see [development setup](#development-setup))

- If adding new feature:

- Add accompanying test case.
- Provide convincing reason to add this feature. Ideally you should open a suggestion issue first and have it greenlighted before working on it.

Expand All @@ -41,7 +42,7 @@ Vue Test Utils is a monorepo. It contains a root package.json for running script

After cloning the repo, run:

``` bash
```bash
$ yarn
```

Expand All @@ -50,9 +51,10 @@ Or with npm:
```bash
npm i && npm run bootstrap
```

### Commonly used NPM scripts

``` bash
```bash
# run unit tests with mocha-webpack
$ npm run test:unit

Expand Down Expand Up @@ -90,4 +92,4 @@ The default test script will do the following: lint with ESLint -> type check wi

- **`types`**: contains TypeScript type definitions

- **`test`**: type definitions tests
- **`test`**: type definitions tests
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package.json
package-lock.json
**/dist/**
CHANGELOG.md
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
This repository provides the following two packages.
They are currently in beta.

* [Vue Test Utils](./packages/test-utils)
* [Vue Server Test Utils](./packages/server-test-utils)
- [Vue Test Utils](./packages/test-utils)
- [Vue Server Test Utils](./packages/server-test-utils)

You can install these packages by the following command.

Expand All @@ -16,6 +16,7 @@ npm install --save-dev @vue/server-test-utils
```

## Peer Dependencies

You need to install `vue-template-compiler` which is used to compile components. It should be the same version as the version of Vue you are using.

```
Expand Down
2 changes: 1 addition & 1 deletion docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ module.exports = {
'/ru/api/options',
'/ru/api/components/'
]
},
}
}
},
markdown: {
Expand Down
134 changes: 67 additions & 67 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@

Vue Test Utils is the official unit testing utility library for Vue.js.

* [Guides](./guides/)
* [Getting Started](./guides/getting-started.md)
* [Common Tips](guides/common-tips.md)
* [Mouse, Key and other DOM Events](guides/dom-events.md)
* [Choosing a test runner](guides/choosing-a-test-runner.md)
* [Testing Single-File Components with Jest](guides/testing-single-file-components-with-jest.md)
* [Testing Single-File Components with Mocha + webpack](guides/testing-single-file-components-with-mocha-webpack.md)
* [Testing Single-File Components with Karma](guides/testing-single-file-components-with-karma.md)
* [Testing Asynchronous Behavior](guides/testing-async-components.md)
* [Using with TypeScript](guides/using-with-typescript.md)
* [Using with Vue Router](guides/using-with-vue-router.md)
* [Using with Vuex](guides/using-with-vuex.md)
* [API](api/)
* [mount](api/mount.md)
* [shallowMount](api/shallowMount.md)
* [render](api/render.md)
* [renderToString](api/renderToString.md)
* [Mounting Options](api/options.md)
- [Guides](./guides/)
- [Getting Started](./guides/getting-started.md)
- [Common Tips](guides/common-tips.md)
- [Mouse, Key and other DOM Events](guides/dom-events.md)
- [Choosing a test runner](guides/choosing-a-test-runner.md)
- [Testing Single-File Components with Jest](guides/testing-single-file-components-with-jest.md)
- [Testing Single-File Components with Mocha + webpack](guides/testing-single-file-components-with-mocha-webpack.md)
- [Testing Single-File Components with Karma](guides/testing-single-file-components-with-karma.md)
- [Testing Asynchronous Behavior](guides/testing-async-components.md)
- [Using with TypeScript](guides/using-with-typescript.md)
- [Using with Vue Router](guides/using-with-vue-router.md)
- [Using with Vuex](guides/using-with-vuex.md)
- [API](api/)
- [mount](api/mount.md)
- [shallowMount](api/shallowMount.md)
- [render](api/render.md)
- [renderToString](api/renderToString.md)
- [Mounting Options](api/options.md)
- [context](api/options.md#context)
- [slots](api/options.md#slots)
- [scopedSlots](api/options.md#scopedslots)
Expand All @@ -34,52 +34,52 @@ Vue Test Utils is the official unit testing utility library for Vue.js.
- [provide](api/options.md#provide)
- [sync](api/options.md#sync)
- [other options](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)
* [setChecked](api/wrapper-array/setChecked.md)
* [setData](api/wrapper-array/setData.md)
* [setMethods](api/wrapper-array/setMethods.md)
* [setProps](api/wrapper-array/setProps.md)
* [setValue](api/wrapper-array/setValue.md)
* [trigger](api/wrapper-array/trigger.md)
* [isVisible](api/wrapper-array/isVisible.md)
* [components](api/components/)
* [TransitionStub](api/components/TransitionStub.md)
* [TransitionGroupStub](api/components/TransitionGroupStub.md)
* [RouterLinkStub](api/components/RouterLinkStub.md)
* [Selectors](api/selectors.md)
* [createWrapper](api/createWrapper.md)
* [createLocalVue](api/createLocalVue.md)
* [config](api/config.md)
- [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)
- [setChecked](api/wrapper-array/setChecked.md)
- [setData](api/wrapper-array/setData.md)
- [setMethods](api/wrapper-array/setMethods.md)
- [setProps](api/wrapper-array/setProps.md)
- [setValue](api/wrapper-array/setValue.md)
- [trigger](api/wrapper-array/trigger.md)
- [isVisible](api/wrapper-array/isVisible.md)
- [components](api/components/)
- [TransitionStub](api/components/TransitionStub.md)
- [TransitionGroupStub](api/components/TransitionGroupStub.md)
- [RouterLinkStub](api/components/RouterLinkStub.md)
- [Selectors](api/selectors.md)
- [createWrapper](api/createWrapper.md)
- [createLocalVue](api/createLocalVue.md)
- [config](api/config.md)
2 changes: 1 addition & 1 deletion docs/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
!!!include(docs/api/selectors.md)!!!
!!!include(docs/api/createLocalVue.md)!!!
!!!include(docs/api/createWrapper.md)!!!
!!!include(docs/api/config.md)!!!
!!!include(docs/api/config.md)!!!
2 changes: 1 addition & 1 deletion docs/api/components/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Vue Test Utils includes utility components you can use to stub components.

!!!include(docs/api/components/RouterLinkStub.md)!!!
!!!include(docs/api/components/TransitionStub.md)!!!
!!!include(docs/api/components/TransitionGroupStub.md)!!!
!!!include(docs/api/components/TransitionGroupStub.md)!!!
4 changes: 2 additions & 2 deletions docs/api/components/TransitionGroupStub.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A component to stub the `transition-group` 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` 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` component set `config.stubs['transition-group']` to false:

```js
import { config } from '@vue/test-utils'
Expand All @@ -28,4 +28,4 @@ mount(Component, {
'transition-group': TransitionGroupStub
}
})
```
```
1 change: 1 addition & 0 deletions docs/api/components/TransitionStub.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ config.stubs.transition = false
```

To reset it to stub `transition` components:

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

Expand Down
5 changes: 1 addition & 4 deletions docs/api/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ Vue Test Utils includes a config object to defined options used by Vue Test Util
### `stubs`

- type: `{ [name: string]: Component | boolean | string }`
- default: `{
transition: TransitionStub,
'transition-group': TransitionGroupStub
}`
- default: `{ transition: TransitionStub, 'transition-group': TransitionGroupStub }`

The stub stored in `config.stubs` is used by default.
Stubs to use in components. These are overwritten by `stubs` passed in the mounting options.
Expand Down
1 change: 1 addition & 0 deletions docs/api/createLocalVue.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## createLocalVue()

- **Returns:**

- `{Component}`

- **Usage:**
Expand Down
2 changes: 1 addition & 1 deletion docs/api/createWrapper.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- `{Boolean} attachedToDocument`

- **Returns:**

- `{Wrapper}`

- **Usage:**
Expand All @@ -23,4 +24,3 @@ const vm = new Constructor().$mount()
const wrapper = createWrapper(vm)
expect(wrapper.vm.foo).toBe(true)
```

1 change: 1 addition & 0 deletions docs/api/mount.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ describe('Foo', () => {
})
})
```

**Default and named slots:**

```js
Expand Down
26 changes: 12 additions & 14 deletions docs/api/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ You can also pass a function that takes the props as an argument:
```js
shallowMount(Component, {
scopedSlots: {
foo: function (props) {
foo: function(props) {
return this.$createElement('div', props.index)
}
}
Expand All @@ -111,8 +111,8 @@ Or you can use JSX. If you write JSX in a method, `this.$createElement` is auto-
```js
shallowMount(Component, {
scopedSlots: {
foo (props) {
return <div>{ props.text }</div>
foo(props) {
return <div>{props.text}</div>
}
}
})
Expand Down Expand Up @@ -179,9 +179,7 @@ import Foo from './Foo.vue'
const localVue = createLocalVue()
localVue.use(VueRouter)

const routes = [
{ path: '/foo', component: Foo }
]
const routes = [{ path: '/foo', component: Foo }]

const router = new VueRouter({
routes
Expand Down Expand Up @@ -228,11 +226,11 @@ const wrapper = mount(Component, {
expect(wrapper.text()).toBe('aBC')
```

::: tip
It's worth noting that `propsData` is actually a [Vue API](https://vuejs.org/v2/api/#propsData), not a
::: tip
It's worth noting that `propsData` is actually a [Vue API](https://vuejs.org/v2/api/#propsData), not a
Vue Test Utils mounting option. It is processed through [`extends`](https://vuejs.org/v2/api/#extends).
Please see [Other options](#other-options).
:::
:::

## listeners

Expand Down Expand Up @@ -273,7 +271,7 @@ const Component = {

const wrapper = shallowMount(Component, {
provide: {
foo () {
foo() {
return 'fooValue'
}
}
Expand All @@ -298,20 +296,20 @@ When the options for `mount` and `shallowMount` contain the options other than t
const Component = {
template: '<div>{{ foo() }}{{ bar() }}{{ baz() }}</div>',
methods: {
foo () {
foo() {
return 'a'
},
bar () {
bar() {
return 'b'
}
}
}
const options = {
methods: {
bar () {
bar() {
return 'B'
},
baz () {
baz() {
return 'C'
}
}
Expand Down
4 changes: 2 additions & 2 deletions docs/api/render.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
- `{Object} context`
- `{Array<Component|Object>|Component} children`
- `{Object} slots`
- `{Array<Component|Object>|Component|String} default`
- `{Array<Component|Object>|Component|String} named`
- `{Array<Component|Object>|Component|String} default`
- `{Array<Component|Object>|Component|String} named`
- `{Object} mocks`
- `{Object|Array<string>} stubs`
- `{Vue} localVue`
Expand Down
Loading

0 comments on commit be4033e

Please sign in to comment.