Skip to content

Commit 994018f

Browse files
committed
fix error message
1 parent 974be4f commit 994018f

File tree

6 files changed

+13
-16
lines changed

6 files changed

+13
-16
lines changed

Diff for: packages/test-utils/src/vue-wrapper.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ export default class VueWrapper extends Wrapper implements BaseWrapper {
1212
// $FlowIgnore : issue with defineProperty
1313
Object.defineProperty(this, 'vnode', {
1414
get: () => vm._vnode,
15-
set: () => throwError(`VueWrapper.vnode is read-only`)
15+
set: () => throwError('wrapper.vnode is read-only')
1616
})
1717
// $FlowIgnore
1818
Object.defineProperty(this, 'element', {
1919
get: () => vm.$el,
20-
set: () => throwError(`VueWrapper.element is read-only`)
20+
set: () => throwError('wrapper.element is read-only')
2121
})
2222
// $FlowIgnore
2323
Object.defineProperty(this, 'vm', {
2424
get: () => vm,
25-
set: () => throwError(`VueWrapper.vm is read-only`)
25+
set: () => throwError('wrapper.vm is read-only')
2626
})
2727
if (options.sync) {
2828
setWatchersToSync(vm)

Diff for: packages/test-utils/src/wrapper-array.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ export default class WrapperArray implements BaseWrapper {
1313
// $FlowIgnore
1414
Object.defineProperty(this, 'wrappers', {
1515
get: () => wrappers,
16-
set: () => throwError(`WrapperArray.wrappers is read-only`)
16+
set: () => throwError('wrapperArray.wrappers is read-only')
1717
})
1818
// $FlowIgnore
1919
Object.defineProperty(this, 'length', {
2020
get: () => length,
21-
set: () => throwError(`WrapperArray.length is read-only`)
21+
set: () => throwError('wrapperArray.length is read-only')
2222
})
2323
}
2424

Diff for: packages/test-utils/src/wrapper.js

+5-8
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import { orderWatchers } from './order-watchers'
2424

2525
export default class Wrapper implements BaseWrapper {
2626
+vnode: VNode | null;
27-
_vnode: VNode | null;
2827
+vm: Component | null;
2928
_emitted: { [name: string]: Array<Array<any>> };
3029
_emittedByOrder: Array<{ name: string, args: Array<any> }>;
@@ -40,28 +39,27 @@ export default class Wrapper implements BaseWrapper {
4039
const element = node instanceof Element ? node : node.elm
4140
// Prevent redefine by VueWrapper
4241
if (this.constructor.name === 'Wrapper') {
43-
this._vnode = vnode
4442
// $FlowIgnore
4543
Object.defineProperty(this, 'vnode', {
46-
get: () => this._vnode,
47-
set: () => throwError(`Wrapper.vnode is read-only`)
44+
get: () => vnode,
45+
set: () => throwError('wrapper.vnode is read-only')
4846
})
4947
// $FlowIgnore
5048
Object.defineProperty(this, 'element', {
5149
get: () => element,
52-
set: () => throwError(`Wrapper.element is read-only`)
50+
set: () => throwError('wrapper.element is read-only')
5351
})
5452
// $FlowIgnore
5553
Object.defineProperty(this, 'vm', {
5654
get: () => undefined,
57-
set: () => throwError(`Wrapper.vm is read-only`)
55+
set: () => throwError('wrapper.vm is read-only')
5856
})
5957
}
6058
const frozenOptions = Object.freeze(options)
6159
// $FlowIgnore
6260
Object.defineProperty(this, 'options', {
6361
get: () => frozenOptions,
64-
set: () => throwError(`${this.constructor.name}.options is read-only`)
62+
set: () => throwError('wrapper.options is read-only')
6563
})
6664
if (
6765
this.vnode &&
@@ -668,7 +666,6 @@ export default class Wrapper implements BaseWrapper {
668666
})
669667

670668
// $FlowIgnore : Problem with possibly null this.vm
671-
this._vnode = this.vm._vnode
672669
orderWatchers(this.vm || this.vnode.context.$root)
673670
Vue.config.silent = originalConfig
674671
}

Diff for: test/specs/vue-wrapper.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ describeWithShallowAndMount('VueWrapper', mountingMethod => {
55
it(`has the ${property} property which is read-only`, () => {
66
const wrapper = mountingMethod({ template: '<div><p></p></div>' })
77
expect(wrapper.constructor.name).to.equal('VueWrapper')
8-
const message = `[vue-test-utils]: VueWrapper.${property} is read-only`
8+
const message = `[vue-test-utils]: wrapper.${property} is read-only`
99
expect(() => { wrapper[property] = 'foo' })
1010
.to.throw()
1111
.with.property('message', message)

Diff for: test/specs/wrapper-array.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describeWithShallowAndMount('WrapperArray', mountingMethod => {
1313
['wrappers', 'length'].forEach(property => {
1414
it(`has the ${property} property which is read-only`, () => {
1515
const wrapperArray = getWrapperArray()
16-
const message = `[vue-test-utils]: WrapperArray.${property} is read-only`
16+
const message = `[vue-test-utils]: wrapperArray.${property} is read-only`
1717
expect(() => { wrapperArray[property] = 'foo' })
1818
.to.throw()
1919
.with.property('message', message)

Diff for: test/specs/wrapper.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ describeWithShallowAndMount('Wrapper', mountingMethod => {
66
const wrapper = mountingMethod({ template: '<div><p></p></div>' })
77
.find('p')
88
expect(wrapper.constructor.name).to.equal('Wrapper')
9-
const message = `[vue-test-utils]: Wrapper.${property} is read-only`
9+
const message = `[vue-test-utils]: wrapper.${property} is read-only`
1010
expect(() => { wrapper[property] = 'foo' })
1111
.to.throw()
1212
.with.property('message', message)

0 commit comments

Comments
 (0)