Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
enter(element) {
const width = getStyleProperty(element, 'width');
element.style.width = width;
element.style.position = 'absolute';
element.style.visibility = 'hidden';
element.style.height = 'auto';
const height = getStyleProperty(element, 'height');
element.style.width = null;
element.style.position = null;
element.style.visibility = null;
element.style.height = 0;
getStyleProperty(element, 'height'); // Force rerender element to set correct height
setTimeout(() => {
element.style.height = height;
});
},
afterEnter(element) {
enter(element) {
const width = getStyleProperty(element, 'width');
element.style.width = width;
element.style.position = 'absolute';
element.style.visibility = 'hidden';
element.style.height = 'auto';
const height = getStyleProperty(element, 'height');
element.style.width = null;
element.style.position = null;
element.style.visibility = null;
element.style.height = 0;
getStyleProperty(element, 'height'); // Force rerender element to set correct height
setTimeout(() => {
element.style.height = height;
leave(element) {
element.style.height = getStyleProperty(element, 'height');
getStyleProperty(element, 'height'); // Force rerender element to set correct height
setTimeout(() => {
element.style.height = 0;
});
}
}
enter(element) {
const width = getStyleProperty(element, 'width');
element.style.width = width;
element.style.position = 'absolute';
element.style.visibility = 'hidden';
element.style.height = 'auto';
const height = getStyleProperty(element, 'height');
element.style.width = null;
element.style.position = null;
element.style.visibility = null;
element.style.height = 0;
getStyleProperty(element, 'height'); // Force rerender element to set correct height
setTimeout(() => {
element.style.height = height;
});
},
afterEnter(element) {
it('should return if Vue.$isServer', () => {
isServer(true);
expect(wrapper.vm.createPopper()).toEqual(undefined);
isServer(false);
});
it('should not add window resize event listener if Vue.$isServer', () => {
isServer(true, wrapper.vm);
const spy = jest.spyOn(window, 'addEventListener');
wrapper.vm.created();
expect(spy).not.toHaveBeenCalledTimes(3);
isServer(false, wrapper.vm);
});
});
it('should return if Vue.$isServer', () => {
isServer(true);
expect(triggerEvent(element, 'eventName')).not.toBeDefined();
isServer(false);
});
it('should equal 0 if window is not defined', () => {
isServer(true);
expect(createWrapper().vm.windowWidth).toEqual(0);
isServer(false);
});
});
it('should be a function calling detachEventBinding on element', () => {
isServer(true);
const spy = jest.spyOn(element, 'detachEvent');
const fn = () => {};
_off()(element, 'eventName', fn);
expect(spy).toHaveBeenCalled();
expect(spy).toHaveBeenCalledWith('oneventName', fn);
isServer(false);
});
it('should not bind mousedown and mouseup events if Vue.$isServer', () => {
isServer(true);
const spy = jest.spyOn(window.document, 'addEventListener');
bindClickOutsideHandler();
expect(spy).not.toHaveBeenCalledTimes(5);
isServer(false);
});
});