Skip to content

Commit

Permalink
Updating test
Browse files Browse the repository at this point in the history
  • Loading branch information
mattgperry committed Jan 11, 2022
1 parent 291ac75 commit ae5333f
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/motion/__tests__/transformTemplate.test.tsx
Expand Up @@ -66,7 +66,7 @@ describe("transformTemplate", () => {
expect(container.firstChild).toHaveStyle("transform: translateY(20px)")
})

it("removes transformTemplate if prop is removed and translate is defined", async () => {
it("removes transformTemplate if prop is removed and transform is changed", async () => {
const { container, rerender } = render(
<motion.div
transformTemplate={() => `translateY(20px)`}
Expand All @@ -83,6 +83,23 @@ describe("transformTemplate", () => {
)
})

it("removes transformTemplate if prop is removed and transform is not changed", async () => {
const { container, rerender } = render(
<motion.div
transformTemplate={() => `translateY(20px)`}
style={{ x: 10 }}
/>
)
expect(container.firstChild).toHaveStyle("transform: translateY(20px)")
rerender(<motion.div style={{ x: 10 }} />)

await new Promise((resolve) => sync.postRender(resolve))

expect(container.firstChild).toHaveStyle(
"transform: translateX(10px) translateZ(0)"
)
})

it("removes transformTemplate if prop is removed", async () => {
const { container, rerender } = render(
<motion.div transformTemplate={() => `translateY(20px)`} />
Expand Down

0 comments on commit ae5333f

Please sign in to comment.