import '@testing-library/jest-dom';
import {dimension} from '@shopify/jest-dom-mocks';
import $, {VeamsQueryObject} from '../src';
beforeEach(() => {
dimension.mock({
offsetHeight: 200,
offsetWidth: 200
});
});
afterEach(() => {
dimension.restore();
});
test('outerHeight() - get height', () => {
document.body.innerHTML = `
text content
`;
const $targetEl: VeamsQueryObject = $(document.getElementById('target-el'));
const outerHeight: number = $targetEl.outerHeight();
expect($targetEl).toHaveLength(1);
expect(outerHeight).toBe(200);
});
test('outerHeight() - get height (including margin)', () => {
document.body.innerHTML = `
text content
text content
`;
const $targetEls: VeamsQueryObject = $('.target-el');
const outerHeight: number = $targetEls.outerHeight(true);
expect($targetEls).toHaveLength(2);
expect(outerHeight).toBe(220);
});