-
Notifications
You must be signed in to change notification settings - Fork 662
Open
Labels
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-utilsversion: 1.3.0Vueversion: 2.6.14nodeversion: 16.17.0npm(oryarn) version: 8.18.0