[Vuejs]-Using querySelector in vue/test-utils

0👍

You can access each element found by const items = wrapper.findAll('.works__item'); with items.at(0), items.at(1), etc…

Considering your mockData is a proper Array, you can do something like:

const items = wrapper.findAll('.works__item');
mockData.forEach((mockEntry, index) => {
  expect(items.at(index).text()).toInclude(mockEntry.description);
});

Leave a comment