Skip to content

Commit

Permalink
fix: remove includes and findIndex (#610)
Browse files Browse the repository at this point in the history
  • Loading branch information
honeroku authored and eddyerburgh committed May 15, 2018
1 parent dbf63bb commit a70a887
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/test-utils/src/find-vnodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ function findAllVNodes (vnode: VNode, nodes: Array<VNode> = []): Array<VNode> {
}

function removeDuplicateNodes (vNodes: Array<VNode>): Array<VNode> {
return vNodes.filter((vNode, index) => index === vNodes.findIndex(node => vNode.elm === node.elm))
const vNodeElms = vNodes.map(vNode => vNode.elm)
return vNodes.filter((vNode, index) => index === vNodeElms.indexOf(vNode.elm))
}

function nodeMatchesRef (node: VNode, refName: string): boolean {
Expand Down
2 changes: 1 addition & 1 deletion packages/test-utils/src/wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ export default class Wrapper implements BaseWrapper {
Object.keys(data).forEach((key) => {
// Ignore properties that were not specified in the component options
// $FlowIgnore : Problem with possibly null this.vm
if (!this.vm.$options._propKeys || !this.vm.$options._propKeys.includes(key)) {
if (!this.vm.$options._propKeys || !this.vm.$options._propKeys.some(prop => prop === key)) {
throwError(`wrapper.setProps() called with ${key} property which is not defined on component`)
}

Expand Down

0 comments on commit a70a887

Please sign in to comment.