Open
Description
When tesing out the mixin, $refs is empty object and cannot be modified.
` import { shallowMount } from '@vue/test-utils';
import AcWidgetMixin from './ac-widget-mixin';
let widgetUuid = '98FADB82-E2AA-4A74-8460-39DF28365435';
function getWrapper() {
const Component = {
render() {},
mixins: [AcWidgetMixin]
};
return shallowMount(Component, {
props: { widgetUuid, totalRecords: 8 }
});
}
let wrapper;
describe('Ac-widget Mixin', () => {
describe('getTableHeight', () => {
describe('when data-table is present', () => {
beforeEach(async () => {
wrapper = getWrapper();
wrapper.vm.$refs.tableRef = { $el: { clientHeight: 1600 } };
});
afterEach(() => wrapper.unmount());
it('Should return clientHeight of element when method is called', () => {
expect(wrapper.vm.getTableHeight()).toBe(1600);
});
});
});
`
Metadata
Metadata
Assignees
Labels
No labels