Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/en/api/wrapper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:**

Expand Down
3 changes: 1 addition & 2 deletions flow/wrapper.flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
1 change: 1 addition & 0 deletions packages/test-utils/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export interface WrapperArray<V extends Vue> extends BaseWrapper {

interface WrapperOptions {
attachedToDocument: boolean
sync: boolean
}

interface MountOptions<V extends Vue> extends ComponentOptions<V> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand All @@ -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', () => {
Expand Down Expand Up @@ -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()
Expand Down