Skip to content

Commit

Permalink
fix: use boolean for VueWrapper (#763)
Browse files Browse the repository at this point in the history
  • Loading branch information
38elements authored and eddyerburgh committed Jun 27, 2018
1 parent ff5220d commit 6fa6ecd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/test-utils/src/vue-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { orderWatchers } from './order-watchers'

export default class VueWrapper extends Wrapper implements BaseWrapper {
constructor (vm: Component, options: WrapperOptions) {
super(vm._vnode, options)
super(vm._vnode, options, true)

// $FlowIgnore : issue with defineProperty
Object.defineProperty(this, 'vnode', {
Expand Down
8 changes: 6 additions & 2 deletions packages/test-utils/src/wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,15 @@ export default class Wrapper implements BaseWrapper {
version: number;
isFunctionalComponent: boolean;

constructor (node: VNode | Element, options: WrapperOptions) {
constructor (
node: VNode | Element,
options: WrapperOptions,
isVueWrapper?: boolean
) {
const vnode = node instanceof Element ? null : node
const element = node instanceof Element ? node : node.elm
// Prevent redefine by VueWrapper
if (this.constructor.name === 'Wrapper') {
if (!isVueWrapper) {
// $FlowIgnore
Object.defineProperty(this, 'vnode', {
get: () => vnode,
Expand Down

0 comments on commit 6fa6ecd

Please sign in to comment.