diff --git a/package.json b/package.json index 9c96aa48..bc483b1c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-motion", - "version": "0.13.0", + "version": "0.13.1-alpha.0", "private": true, "packageManager": "pnpm@9.15.0+sha1.8bfdb6d72b4d5fdf87d21d27f2bfbe2b21dd2629", "description": "", diff --git a/packages/motion/package.json b/packages/motion/package.json index 8bddd7b4..0cb14f86 100644 --- a/packages/motion/package.json +++ b/packages/motion/package.json @@ -1,6 +1,6 @@ { "name": "motion-v", - "version": "0.13.0", + "version": "0.13.1-alpha.0", "description": "", "author": "", "license": "MIT", diff --git a/packages/motion/src/components/__tests__/svg.test.ts b/packages/motion/src/components/__tests__/svg.test.ts new file mode 100644 index 00000000..b91522e6 --- /dev/null +++ b/packages/motion/src/components/__tests__/svg.test.ts @@ -0,0 +1,38 @@ +import { describe, expect, it } from 'vitest' +import { render } from '@testing-library/vue' +import { Motion } from '@/components' +import { motionValue } from 'framer-motion/dom' +import { nextTick } from 'vue' +import { delay } from '@/shared/test' + +describe('row-value', () => { + it('should render initial value', async () => { + const opacity = motionValue(0) + const stroke = motionValue('red') + const wrapper = render(Motion, { + props: { + as: 'path', + style: { + opacity, + stroke, + }, + }, + attrs: { + 'data-testid': 'path', + }, + }) + await nextTick() + const path = wrapper.getByTestId('path') + expect(path.style.opacity).toBeFalsy() + expect(path.style.stroke).toBeFalsy() + expect(path.getAttribute('stroke')).toBe('red') + expect(path.getAttribute('opacity')).toBe('0') + opacity.set(1) + stroke.set('blue') + await delay(100) + expect(path.style.opacity).toBeFalsy() + expect(path.style.stroke).toBeFalsy() + expect(path.getAttribute('stroke')).toBe('blue') + expect(path.getAttribute('opacity')).toBe('1') + }) +}) diff --git a/packages/motion/src/components/motion/Motion.vue b/packages/motion/src/components/motion/Motion.vue index 81f06d7e..4631a589 100644 --- a/packages/motion/src/components/motion/Motion.vue +++ b/packages/motion/src/components/motion/Motion.vue @@ -7,6 +7,7 @@ import { checkMotionIsHidden } from './utils' import type { AsTag, ComponentProps, ElementType, Options, SVGAttributesWithMotionValues, SetMotionValueType } from '@/types' import { useMotionConfig } from '../motion-config/context' import { getMotionElement } from '../hooks/use-motion-elm' +import type { DOMKeyframesDefinition } from 'motion-dom'