Skip to content

Commit

Permalink
chore: bump version of composition api (#1583)
Browse files Browse the repository at this point in the history
* chore: bump version of composition api

* chore: run prettier
  • Loading branch information
lmiller1990 committed Jun 16, 2020
1 parent 73a869b commit 2e46ad4
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 10 deletions.
1 change: 0 additions & 1 deletion docs/zh/guides/common-tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ it('render text', done => {

可以在[测试异步行为](../guides/README.md#测试异步行为)了解更多。


### 断言触发的事件

每个挂载的包裹器都会通过其背后的 Vue 实例自动记录所有被触发的事件。你可以用 `wrapper.emitted()` 方法取回这些事件记录。
Expand Down
3 changes: 1 addition & 2 deletions docs/zh/guides/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ it('button click should increment the count', () => {

任何导致操作 DOM 的改变都应该在断言之前 await `nextTick` 函数。因为 Vue 会对未生效的 DOM 进行批量*异步更新*,避免因数据反复变化而导致不必要的渲染。

*你可以阅读[Vue 文档](https://cn.vuejs.org/v2/guide/reactivity.html#异步更新队列)了解更多关于异步指更新的信息。*
_你可以阅读[Vue 文档](https://cn.vuejs.org/v2/guide/reactivity.html#异步更新队列)了解更多关于异步指更新的信息。_

在更新响应式 property 之后,我们可以直接 await 类似 `trigger``trigger.vm.$nextTick` 方法,等待 Vue 完成 DOM 更新。在这个计数器的示例中,设置 `count` property 会在运行下一个 tick 之后引发 DOM 变化。

Expand Down Expand Up @@ -177,7 +177,6 @@ it('will catch the error using async/await', async () => {

### 接下来


- 移步[编写测试的常见技巧](./README.md#明白要测试的是什么)以学习更多。
- [选择一个测试运行器](./README.md#选择一个测试运行器)以把 Vue Test Utils 集成到你的工程里。
- 学习更多[异步测试行为](./README.md#异步测试行为)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"devDependencies": {
"@commitlint/cli": "^8.2.0",
"@commitlint/config-conventional": "^8.2.0",
"@vue/composition-api": "^0.3.2",
"@vue/composition-api": "^0.6.4",
"commitizen": "^4.0.3",
"cz-conventional-changelog": "^3.0.2",
"husky": "^3.1.0",
Expand Down
13 changes: 13 additions & 0 deletions test/specs/mount.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Vue from 'vue'
import { compileToFunctions } from 'vue-template-compiler'
import { mount, createLocalVue } from '@vue/test-utils'
import CompositionAPI, { createElement } from '@vue/composition-api'
import Component from '~resources/components/component.vue'
import ComponentWithProps from '~resources/components/component-with-props.vue'
import ComponentWithMixin from '~resources/components/component-with-mixin.vue'
Expand Down Expand Up @@ -439,6 +440,18 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'mount', () => {
})
})

it('works with composition api plugin', () => {
const localVue = createLocalVue()
localVue.use(CompositionAPI)
const Comp = {
setup() {
return () => createElement('div', 'composition api')
}
}
const wrapper = mount(Comp, { localVue })
expect(wrapper.html()).to.equal('<div>composition api</div>')
})

itDoNotRunIf.skip(
vueVersion >= 2.5,
'throws if component throws during update',
Expand Down
17 changes: 11 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1860,12 +1860,12 @@
source-map "^0.5.6"
vue-template-es2015-compiler "^1.6.0"

"@vue/composition-api@^0.3.2":
version "0.3.2"
resolved "https://registry.yarnpkg.com/@vue/composition-api/-/composition-api-0.3.2.tgz#2d797028e489bf7812f08c7bb33ffd03ef23c617"
integrity sha512-fD4dn9cJX62QSP2TMFLXCOQOa+Bu2o7kWDjrU/FNLkNqPPcCKBLxCH/Lc+gNCRBKdEUGyI3arjAw7j0Yz1hnvw==
"@vue/composition-api@^0.6.4":
version "0.6.4"
resolved "https://registry.yarnpkg.com/@vue/composition-api/-/composition-api-0.6.4.tgz#b12a85183eecdbb18453efae28853edb77b4a625"
integrity sha512-WQUqp61c1WH5pAmbUM5xUBYZYWh3TV48h1jLl2pofidXGglTS9+bvCfHKTk0bsA/U5ZbzfUMa1IpQGUGdYZYeA==
dependencies:
tslib "^1.9.3"
tslib "^2.0.0"

"@webassemblyjs/ast@1.4.3":
version "1.4.3"
Expand Down Expand Up @@ -12404,11 +12404,16 @@ trough@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/trough/-/trough-1.0.1.tgz#a9fd8b0394b0ae8fff82e0633a0a36ccad5b5f86"

tslib@^1.9.0, tslib@^1.9.3:
tslib@^1.9.0:
version "1.10.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a"
integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==

tslib@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.0.0.tgz#18d13fc2dce04051e20f074cc8387fd8089ce4f3"
integrity sha512-lTqkx847PI7xEDYJntxZH89L2/aXInsyF2luSafe/+0fHOMjlBNXdH6th7f70qxLDhul7KZK0zC8V5ZIyHl0/g==

tty-browserify@0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6"
Expand Down

0 comments on commit 2e46ad4

Please sign in to comment.