Skip to content

Commit 17d336e

Browse files
authored
chore: fix typos (#1533)
* chore: fix typos * chore: remove deprecation until further notice * fix: add attachTo type
1 parent 6529d4d commit 17d336e

File tree

4 files changed

+10
-17
lines changed

4 files changed

+10
-17
lines changed

packages/shared/util.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export function nextTick(): Promise<void> {
102102

103103
export function warnDeprecated(method: string, fallback: string = '') {
104104
if (!config.showDeprecationWarnings) return
105-
let msg = `${method} is deprecated and will removed in the next major version`
105+
let msg = `${method} is deprecated and will be removed in the next major version`
106106
if (fallback) msg += ` ${fallback}`
107107
warn(msg)
108108
}

packages/test-utils/src/wrapper.js

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export default class Wrapper implements BaseWrapper {
142142
* Calls destroy on vm
143143
*/
144144
destroy(): void {
145-
if (!this.isVueInstance() && !this.isFunctionalComponent) {
145+
if (!this.vm && !this.isFunctionalComponent) {
146146
throwError(
147147
`wrapper.destroy() can only be called on a Vue instance or ` +
148148
`functional component.`
@@ -153,7 +153,7 @@ export default class Wrapper implements BaseWrapper {
153153
this.element.parentNode.removeChild(this.element)
154154
}
155155

156-
if (this.isVueInstance()) {
156+
if (this.vm) {
157157
// $FlowIgnore
158158
this.vm.$destroy()
159159
throwIfInstancesThrew(this.vm)
@@ -370,7 +370,7 @@ export default class Wrapper implements BaseWrapper {
370370
*/
371371
isVisible(): boolean {
372372
warnDeprecated(
373-
'isEmpty',
373+
'isVisible',
374374
`Consider a custom matcher such as those provided in jest-dom: https://github.com/testing-library/jest-dom#tobevisible`
375375
)
376376
let element = this.element
@@ -428,7 +428,7 @@ export default class Wrapper implements BaseWrapper {
428428
overview(): void {
429429
warnDeprecated(`overview`)
430430

431-
if (!this.isVueInstance()) {
431+
if (!this.vm) {
432432
throwError(`wrapper.overview() can only be called on a Vue instance`)
433433
}
434434

@@ -530,11 +530,6 @@ export default class Wrapper implements BaseWrapper {
530530
* @deprecated
531531
*/
532532
setChecked(checked: boolean = true): Promise<*> {
533-
warnDeprecated(
534-
`setChecked`,
535-
'When you migrate to VTU 2, use setValue instead.'
536-
)
537-
538533
if (typeof checked !== 'boolean') {
539534
throwError('wrapper.setChecked() must be passed a boolean')
540535
}
@@ -582,11 +577,6 @@ export default class Wrapper implements BaseWrapper {
582577
* @deprecated
583578
*/
584579
setSelected(): Promise<void> {
585-
warnDeprecated(
586-
`setSelected`,
587-
'When you migrate to VTU 2, use setValue instead.'
588-
)
589-
590580
const tagName = this.element.tagName
591581

592582
if (tagName === 'SELECT') {
@@ -642,7 +632,7 @@ export default class Wrapper implements BaseWrapper {
642632
setMethods(methods: Object): void {
643633
warnDeprecated(`setMethods`)
644634

645-
if (!this.isVueInstance()) {
635+
if (!this.vm) {
646636
throwError(`wrapper.setMethods() can only be called on a Vue instance`)
647637
}
648638
Object.keys(methods).forEach(key => {

packages/test-utils/types/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,12 @@ export interface WrapperArray<V extends Vue> extends BaseWrapper {
136136
}
137137

138138
interface WrapperOptions {
139-
attachTo?: Element | string
140139
attachedToDocument?: boolean
141140
}
142141

143142
interface MountOptions<V extends Vue> extends ComponentOptions<V> {
144143
attachToDocument?: boolean
144+
attachTo?: Element | string
145145
context?: VNodeData
146146
localVue?: typeof Vue
147147
mocks?: object | false

packages/test-utils/types/test/mount.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ mount(ClassComponent, {
2828
mocks: {
2929
$store: store
3030
},
31+
attachTo: '#el',
3132
parentComponent: normalOptions,
3233
slots: {
3334
default: `<div>Foo</div>`,
@@ -57,6 +58,7 @@ mount(functionalOptions, {
5758
context: {
5859
props: { foo: 'test' }
5960
},
61+
attachTo: document.createElement('div'),
6062
stubs: ['child']
6163
})
6264

@@ -100,6 +102,7 @@ config.provide['foo'] = {
100102
bar: {}
101103
}
102104
config.silent = true
105+
config.showDeprecationWarnings = false
103106

104107
// Check we can use default export
105108
VueTestUtils.config.silent = false

0 commit comments

Comments
 (0)