Skip to content

Commit 570d80d

Browse files
38elementseddyerburgh
authored andcommitted
fix(types): add sync to WrapperOptions (#590)
1 parent 31202ab commit 570d80d

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

Diff for: docs/en/api/wrapper/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ A `Wrapper` is an object that contains a mounted component or vnode and methods
99
`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
1010
`element` `HTMLElement`: the root DOM node of the wrapper
1111
`options` `Object`: Object containing Vue Test Utils options passed to `mount` or `shallowMount`
12-
`options.attachedToDom` `Boolean`: True if `attachToDom` was passed to `mount` or `shallowMount`
12+
`options.attachedToDocument` `Boolean`: True if `attachedToDocument` was passed to `mount` or `shallowMount`
13+
`options.sync` `Boolean`: True if `sync` was not passed as `false` to `mount` or `shallowMount`
1314

1415
- **Methods:**
1516

Diff for: flow/wrapper.flow.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,5 @@ declare interface BaseWrapper { // eslint-disable-line no-undef
3939

4040
declare type WrapperOptions = { // eslint-disable-line no-undef
4141
attachedToDocument: boolean,
42-
sync: boolean,
43-
error?: string
42+
sync: boolean
4443
}

Diff for: packages/test-utils/types/index.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ export interface WrapperArray<V extends Vue> extends BaseWrapper {
113113

114114
interface WrapperOptions {
115115
attachedToDocument: boolean
116+
sync: boolean
116117
}
117118

118119
interface MountOptions<V extends Vue> extends ComponentOptions<V> {

Diff for: test/specs/mounting-options/snyc.spec.js renamed to test/specs/mounting-options/sync.spec.js

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ describeWithShallowAndMount('options.sync', (mountingMethod) => {
1515
expect(wrapper.text()).to.equal('hello')
1616
wrapper.vm.someData = 'world'
1717
expect(wrapper.text()).to.equal('world')
18+
expect(wrapper.options.sync).to.equal(true)
1819
})
1920

2021
it('sets watchers to sync if undefined', () => {
@@ -29,6 +30,7 @@ describeWithShallowAndMount('options.sync', (mountingMethod) => {
2930
expect(wrapper.text()).to.equal('hello')
3031
wrapper.vm.someData = 'world'
3132
expect(wrapper.text()).to.equal('world')
33+
expect(wrapper.options.sync).to.equal(true)
3234
})
3335

3436
it('handles methods that update watchers', () => {
@@ -102,6 +104,7 @@ describeWithShallowAndMount('options.sync', (mountingMethod) => {
102104
expect(wrapper.text()).to.equal('hello')
103105
wrapper.vm.someData = 'world'
104106
expect(wrapper.text()).to.equal('hello')
107+
expect(wrapper.options.sync).to.equal(false)
105108
setTimeout(() => {
106109
expect(wrapper.text()).to.equal('world')
107110
done()

0 commit comments

Comments
 (0)