Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(collapse): show children if initial in prop is true
- Loading branch information
1 parent
c81326e
commit 2416cf9
Showing
4 changed files
with
46 additions
and
1 deletion.
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,6 @@ | ||
--- | ||
"@chakra-ui/transition": patch | ||
--- | ||
|
||
Fixed a bug where children of `<Collapse />` where not rendered if prop `in` was | ||
true on first render |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import * as React from "react" | ||
import { Collapse } from "../src" | ||
import { render, screen } from "@chakra-ui/test-utils" | ||
|
||
describe("<Collapse />", () => { | ||
it("should hide its children", async () => { | ||
render( | ||
<Collapse> | ||
<div data-testid="collapse-children">Test</div> | ||
</Collapse>, | ||
) | ||
expect(await screen.findByTestId("collapse-children")).not.toBeVisible() | ||
}) | ||
|
||
it("should render its children on initial in", async () => { | ||
render( | ||
<Collapse in> | ||
<div data-testid="collapse-children">Test</div> | ||
</Collapse>, | ||
) | ||
expect(await screen.findByTestId("collapse-children")).toBeVisible() | ||
}) | ||
}) |