Open
Description
Describe the bug
The findAll
function returns an array of the correct amount, but all elements in the array are undefined
.
To Reproduce
describe('CompanyDetail', () => {
it('should render company data', () => {
const component = mount(CompanyDetail, { /* props */ });
const labels = component.findAll('labels');
console.log(labels, labels.length);
// --> `WrapperArray { selector: 'label' } 18`
for (let i = 0; i < labels.length; i += 1) {
console.log(labels[i]);
}
// --> `undefined` (repeating 18 times)
expect(labels[0].text()).toContain('Company name');
// --> `TypeError: Cannot read properties of undefined (reading 'text')`
});
});
Expected behavior
Return of findAll
should iterate over all found elements, rather than a not-so-useful collection of undefined
values.
Related information:
@vue/test-utils
version: 1.3.0Vue
version: 2.6.14node
version: 16.17.0npm
(oryarn
) version: 8.18.0