-
Notifications
You must be signed in to change notification settings - Fork 744
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
add9320
commit c225c23
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
) | ||
} |