Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

While testing out mixins, the $refs cannot be modified and due to which the testing cannot occur. #2098

Open
shivamp-argus opened this issue Aug 22, 2024 · 0 comments

Comments

@shivamp-argus
Copy link

shivamp-argus commented Aug 22, 2024

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);
  });
});

});
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant