diff --git a/docs/en/api/wrapper/README.md b/docs/en/api/wrapper/README.md index 43a241fe1..846c4729d 100644 --- a/docs/en/api/wrapper/README.md +++ b/docs/en/api/wrapper/README.md @@ -9,7 +9,8 @@ A `Wrapper` is an object that contains a mounted component or vnode and methods `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 `shallowMount` -`options.attachedToDom` `Boolean`: True if `attachToDom` was passed to `mount` or `shallowMount` +`options.attachedToDocument` `Boolean`: True if `attachedToDocument` was passed to `mount` or `shallowMount` +`options.sync` `Boolean`: True if `sync` was not passed as `false` to `mount` or `shallowMount` - **Methods:** diff --git a/flow/wrapper.flow.js b/flow/wrapper.flow.js index 3ceb4f6f8..ae24b167a 100644 --- a/flow/wrapper.flow.js +++ b/flow/wrapper.flow.js @@ -39,6 +39,5 @@ declare interface BaseWrapper { // eslint-disable-line no-undef declare type WrapperOptions = { // eslint-disable-line no-undef attachedToDocument: boolean, - sync: boolean, - error?: string + sync: boolean } diff --git a/packages/test-utils/types/index.d.ts b/packages/test-utils/types/index.d.ts index 5d1f4f48e..e097ca593 100644 --- a/packages/test-utils/types/index.d.ts +++ b/packages/test-utils/types/index.d.ts @@ -113,6 +113,7 @@ export interface WrapperArray extends BaseWrapper { interface WrapperOptions { attachedToDocument: boolean + sync: boolean } interface MountOptions extends ComponentOptions { diff --git a/test/specs/mounting-options/snyc.spec.js b/test/specs/mounting-options/sync.spec.js similarity index 95% rename from test/specs/mounting-options/snyc.spec.js rename to test/specs/mounting-options/sync.spec.js index 1984c7ef8..d387351e0 100644 --- a/test/specs/mounting-options/snyc.spec.js +++ b/test/specs/mounting-options/sync.spec.js @@ -15,6 +15,7 @@ describeWithShallowAndMount('options.sync', (mountingMethod) => { expect(wrapper.text()).to.equal('hello') wrapper.vm.someData = 'world' expect(wrapper.text()).to.equal('world') + expect(wrapper.options.sync).to.equal(true) }) it('sets watchers to sync if undefined', () => { @@ -29,6 +30,7 @@ describeWithShallowAndMount('options.sync', (mountingMethod) => { expect(wrapper.text()).to.equal('hello') wrapper.vm.someData = 'world' expect(wrapper.text()).to.equal('world') + expect(wrapper.options.sync).to.equal(true) }) it('handles methods that update watchers', () => { @@ -102,6 +104,7 @@ describeWithShallowAndMount('options.sync', (mountingMethod) => { expect(wrapper.text()).to.equal('hello') wrapper.vm.someData = 'world' expect(wrapper.text()).to.equal('hello') + expect(wrapper.options.sync).to.equal(false) setTimeout(() => { expect(wrapper.text()).to.equal('world') done()