-
Notifications
You must be signed in to change notification settings - Fork 745
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1299 from framer/fix/cancelled-animations-notify-…
…when-done Fix cancelled animations neglecting to notify they are done
- Loading branch information
Showing
5 changed files
with
56 additions
and
8 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> | ||
) | ||
} |
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
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
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