Skip to content

Commit 6348c49

Browse files
committed
Updating
1 parent 40f5ebe commit 6348c49

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

packages/framer-motion-3d/src/render/create-visual-element.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export class ThreeVisualElement extends VisualElement<
4444
makeTargetAnimatableFromInstance({
4545
transition,
4646
transitionEnd,
47+
transitionFrom,
4748
...target
4849
}: TargetAndTransition) {
4950
checkTargetForNewValues(this, target, {})

packages/framer-motion/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"clean": "rm -rf types dist lib",
4747
"test": "yarn test-server && yarn test-client",
4848
"test-ci": "yarn test",
49-
"test-client": "jest --config jest.config.json --max-workers=2 src/motion/__tests__/transition-from.test.tsx",
49+
"test-client": "jest --config jest.config.json --max-workers=2",
5050
"test-server": "jest --config jest.config.ssr.json ",
5151
"test-watch": "jest --watch --coverage --coverageReporters=lcov --config jest.config.json",
5252
"test-appear": "yarn run collect-appear-tests && start-server-and-test 'pushd ../../; python -m SimpleHTTPServer; popd' http://0.0.0.0:8000 'cypress run -s cypress/integration/appear.chrome.ts --config baseUrl=http://localhost:8000/'",

packages/framer-motion/src/motion/__tests__/transition-from.test.tsx

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { pointerEnter, render } from "../../../jest.setup"
1+
import { pointerEnter, pointerLeave, render } from "../../../jest.setup"
22
import { motion, motionValue, frame } from "../../"
33
import * as React from "react"
44

@@ -79,14 +79,22 @@ describe("transitionFrom", () => {
7979
})
8080

8181
test("transitionFrom works with gestures", async () => {
82-
const promise = new Promise((resolve) => {
82+
const promise = new Promise<number[]>((resolve) => {
83+
const output: number[] = []
8384
const opacity = motionValue(1)
8485
const Component = () => (
8586
<motion.div
8687
whileHover={{
8788
opacity: 0,
89+
transitionFrom: {
90+
animate: { type: false },
91+
},
92+
}}
93+
animate={{
94+
opacity: 0.5,
8895
transitionFrom: {
8996
initial: { type: false },
97+
whileHover: { type: false },
9098
},
9199
}}
92100
style={{ opacity }}
@@ -96,11 +104,20 @@ describe("transitionFrom", () => {
96104
const { container, rerender } = render(<Component />)
97105
rerender(<Component />)
98106

107+
output.push(opacity.get())
108+
99109
pointerEnter(container.firstChild as Element)
100110

101-
resolve(opacity.get())
111+
output.push(opacity.get())
112+
113+
setTimeout(() => {
114+
pointerLeave(container.firstChild as Element)
115+
116+
output.push(opacity.get())
117+
resolve(output)
118+
}, 10)
102119
})
103120

104-
return expect(promise).resolves.toBe(0)
121+
return expect(promise).resolves.toEqual([0.5, 0, 0.5])
105122
})
106123
})

0 commit comments

Comments
 (0)