Skip to content

Commit c8d082a

Browse files
committed
test: update flow-bin and fix errors
1 parent 9669abb commit c8d082a

File tree

4 files changed

+13
-14
lines changed

4 files changed

+13
-14
lines changed

flow/vue.flow.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22

33
// Importing these types declares them, so they are available globally
44

5-
import type VNode from 'vue/src/core/vdom/vnode' // eslint-disable-line no-unused-vars
6-
import type Component from 'vue/flow/component' // eslint-disable-line no-unused-vars
7-
import type GlobalAPI from 'vue/flow/global-api' // eslint-disable-line no-unused-vars
5+
declare type Component = Object // eslint-disable-line no-undef
6+
declare type VNode = Object // eslint-disable-line no-undef

flow/wrapper.flow.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ declare type Selector = any
88
declare interface BaseWrapper { // eslint-disable-line no-undef
99
at(index: number): Wrapper | void,
1010
contains(selector: Selector): boolean | void,
11-
emitted(): { [name: string]: Array<Array<any>> } | void,
11+
emitted(event?: string): { [name: string]: Array<Array<any>> } | Array<Array<any>> | void,
1212
emittedByOrder(): Array<{ name: string; args: Array<any> }> | void,
1313
exists(): boolean,
1414
hasAttribute(attribute: string, value: string): boolean | void,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"eslint-plugin-markdown": "^1.0.0-beta.6",
5858
"eslint-plugin-vue": "^2.0.1",
5959
"eslint-plugin-vue-libs": "1.2.0",
60-
"flow-bin": "^0.47.0",
60+
"flow-bin": "^0.61.0",
6161
"gitbook-cli": "^2.3.0",
6262
"gitbook-plugin-edit-link": "^2.0.2",
6363
"gitbook-plugin-github": "^3.0.0",

src/wrappers/wrapper.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export default class Wrapper implements BaseWrapper {
7979
}
8080

8181
if (selectorType === selectorTypes.OPTIONS_OBJECT) {
82-
if (!this.isVueComponent) {
82+
if (!this.vm) {
8383
throwError('$ref selectors can only be used on Vue component wrappers')
8484
}
8585
const nodes = findVNodesByRef(this.vnode, selector.ref)
@@ -96,7 +96,7 @@ export default class Wrapper implements BaseWrapper {
9696
/**
9797
* Returns an object containing custom events emitted by the Wrapper vm
9898
*/
99-
emitted (event: ?string) {
99+
emitted (event?: string) {
100100
if (!this._emitted && !this.vm) {
101101
throwError('wrapper.emitted() can only be called on a Vue instance')
102102
}
@@ -120,7 +120,7 @@ export default class Wrapper implements BaseWrapper {
120120
* Utility to check wrapper exists. Returns true as Wrapper always exists
121121
*/
122122
exists (): boolean {
123-
if (this.isVueComponent) {
123+
if (this.vm) {
124124
return !!this.vm && !this.vm._isDestroyed
125125
}
126126
return true
@@ -241,7 +241,7 @@ export default class Wrapper implements BaseWrapper {
241241
}
242242

243243
if (selectorType === selectorTypes.OPTIONS_OBJECT) {
244-
if (!this.isVueComponent) {
244+
if (!this.vm) {
245245
throwError('$ref selectors can only be used on Vue component wrappers')
246246
}
247247
if (this.vm && this.vm.$refs && selector.ref in this.vm.$refs && this.vm.$refs[selector.ref] instanceof Vue) {
@@ -278,7 +278,7 @@ export default class Wrapper implements BaseWrapper {
278278
}
279279

280280
if (selectorType === selectorTypes.OPTIONS_OBJECT) {
281-
if (!this.isVueComponent) {
281+
if (!this.vm) {
282282
throwError('$ref selectors can only be used on Vue component wrappers')
283283
}
284284
if (this.vm && this.vm.$refs && selector.ref in this.vm.$refs && this.vm.$refs[selector.ref] instanceof Vue) {
@@ -311,7 +311,7 @@ export default class Wrapper implements BaseWrapper {
311311
is (selector: Selector): boolean {
312312
const selectorType = getSelectorTypeOrThrow(selector, 'is')
313313

314-
if (selectorType === selectorTypes.VUE_COMPONENT && this.isVueComponent) {
314+
if (selectorType === selectorTypes.VUE_COMPONENT && this.vm) {
315315
if (typeof selector.name !== 'string') {
316316
throwError('a Component used as a selector must have a name property')
317317
}
@@ -349,7 +349,7 @@ export default class Wrapper implements BaseWrapper {
349349
* Returns name of component, or tag name if node is not a Vue component
350350
*/
351351
name (): string {
352-
if (this.isVueComponent && this.vm) {
352+
if (this.vm) {
353353
return this.vm.$options.name
354354
}
355355

@@ -360,7 +360,7 @@ export default class Wrapper implements BaseWrapper {
360360
* Returns an Object containing the prop name/value pairs on the element
361361
*/
362362
props (): { [name: string]: any } {
363-
if (!this.isVueComponent) {
363+
if (!this.vm) {
364364
throwError('wrapper.props() must be called on a Vue instance')
365365
}
366366
// $props object does not exist in Vue 2.1.x, so use $options.propsData instead
@@ -378,7 +378,7 @@ export default class Wrapper implements BaseWrapper {
378378
* Sets vm data
379379
*/
380380
setData (data: Object) {
381-
if (!this.isVueComponent) {
381+
if (!this.vm) {
382382
throwError('wrapper.setData() can only be called on a Vue instance')
383383
}
384384

0 commit comments

Comments
 (0)