diff --git a/docs/zh/guides/common-tips.md b/docs/zh/guides/common-tips.md index d6604a8ba..3c7c80745 100644 --- a/docs/zh/guides/common-tips.md +++ b/docs/zh/guides/common-tips.md @@ -65,7 +65,6 @@ it('render text', done => { 可以在[测试异步行为](../guides/README.md#测试异步行为)了解更多。 - ### 断言触发的事件 每个挂载的包裹器都会通过其背后的 Vue 实例自动记录所有被触发的事件。你可以用 `wrapper.emitted()` 方法取回这些事件记录。 diff --git a/docs/zh/guides/getting-started.md b/docs/zh/guides/getting-started.md index bb5eea9c3..70f35f93b 100644 --- a/docs/zh/guides/getting-started.md +++ b/docs/zh/guides/getting-started.md @@ -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 变化。 @@ -177,7 +177,6 @@ it('will catch the error using async/await', async () => { ### 接下来 - - 移步[编写测试的常见技巧](./README.md#明白要测试的是什么)以学习更多。 - [选择一个测试运行器](./README.md#选择一个测试运行器)以把 Vue Test Utils 集成到你的工程里。 - 学习更多[异步测试行为](./README.md#异步测试行为) diff --git a/package.json b/package.json index 71a6b467f..4e2719338 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/test/specs/mount.spec.js b/test/specs/mount.spec.js index d9869c512..b7b0dc738 100644 --- a/test/specs/mount.spec.js +++ b/test/specs/mount.spec.js @@ -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' @@ -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('
composition api
') + }) + itDoNotRunIf.skip( vueVersion >= 2.5, 'throws if component throws during update', diff --git a/yarn.lock b/yarn.lock index 1f80eba4b..18a5a5980 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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" @@ -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"