Skip to content

Commit

Permalink
add e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobSmith-Framer committed Oct 21, 2021
1 parent add9320 commit c225c23
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cypress/integration/layout-cancelled-finishes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
describe("Cancelled Animation", () => {
it("Allows the animation to be marked complete", () => {
cy.visit("?test=layout-cancelled-finishes")
.get("[data-testid='cancellable']")
.trigger("click")
.wait(200)
.should(($cancellable: any) => {
const cancellable = $cancellable[0] as HTMLDivElement
expect(cancellable).to.not.exist
})
})
})
19 changes: 19 additions & 0 deletions dev/tests/layout-cancelled-finishes.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import * as React from "react"
import { motion, AnimatePresence, useInstantLayoutTransition } from "@framer"

export const App = () => {
const [isVisible, setIsVisible] = React.useState(true)
const startTransition = useInstantLayoutTransition()

return (
<AnimatePresence>
{isVisible && (
<motion.div
onClick={() => startTransition(() => setIsVisible(false))}
data-testid="cancellable"
style={{ height: 100 }}
/>
)}
</AnimatePresence>
)
}

0 comments on commit c225c23

Please sign in to comment.