forked from vuejs/vue-test-utils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue-wrapper.js
31 lines (28 loc) · 907 Bytes
/
vue-wrapper.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// @flow
import Wrapper from './wrapper'
import { setWatchersToSync } from './set-watchers-to-sync'
import { orderWatchers } from './order-watchers'
export default class VueWrapper extends Wrapper implements BaseWrapper {
constructor (vm: Component, options: WrapperOptions) {
super(vm._vnode, options)
// $FlowIgnore : issue with defineProperty - https://github.com/facebook/flow/issues/285
Object.defineProperty(this, 'vnode', ({
get: () => vm._vnode,
set: () => {}
}))
// $FlowIgnore
Object.defineProperty(this, 'element', ({
get: () => vm.$el,
set: () => {}
}))
this.vm = vm
if (options.sync) {
setWatchersToSync(vm)
orderWatchers(vm)
}
this.isVueComponent = true
this.isFunctionalComponent = vm.$options._isFunctionalContainer
this._emitted = vm.__emitted
this._emittedByOrder = vm.__emittedByOrder
}
}