You’re browsing the documentation for Vue Test Utils for Vue v2.x and earlier.
To read docs for Vue Test Utils for Vue 3, click here.
filter
Filter WrapperArray
with a predicate function on Wrapper
objects.
Behavior of this method is similar to Array.prototype.filter.
Arguments:
{function} predicate
Returns:
{WrapperArray}
A new WrapperArray
instance containing Wrapper
instances that returns true for the predicate function.
- Example:
import { shallowMount } from '@vue/test-utils'
import Foo from './Foo.vue'
const wrapper = shallowMount(Foo)
const filteredDivArray = wrapper
.findAll('div')
.filter(w => !w.classes('filtered'))