I tried to get the value of offsetwidth but it was always 0
Template.spec.js
import { mount } from '@vue/test-utils';
import Template from '~/components/Template.vue';
describe('Template', () => {
const wrapper = mount(Template);
it('get offsetWidth', async () => {
await wrapper.vm.$nextTick()
console.log(wrapper.element.offsetWidth) // 0
});
});
Template.vue
<template>
<div class="template" style="width:100px">
</div>
</template>