mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-11-07 02:55:24 +00:00
fix: hide empty tile stack sections so closed editors add no lines
This commit is contained in:
1 parent
76d41a2cbb
commit
191d5b2e57
2 files changed
+14
-1
No files matched your search
@@ -21,7 +21,7 @@ export function TileStack({
|
|||||||
{Children.toArray(children).map((section, index) => (
|
{Children.toArray(children).map((section, index) => (
|
||||||
<div
|
<div
|
||||||
key={keyOf(section, index)}
|
key={keyOf(section, index)}
|
||||||
className="min-w-0 shrink-0 border-b border-border [&>[data-slot=toolbar-band]]:border-b-0"
|
className="min-w-0 shrink-0 border-b border-border empty:hidden [&>[data-slot=toolbar-band]]:border-b-0"
|
||||||
>
|
>
|
||||||
{section}
|
{section}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -113,6 +113,19 @@ describe("TileStack", () => {
|
|||||||
expect(screen.getByText("first").parentElement).toHaveClass("border-b");
|
expect(screen.getByText("first").parentElement).toHaveClass("border-b");
|
||||||
expect(screen.getByText("second").parentElement).toHaveClass("border-b");
|
expect(screen.getByText("second").parentElement).toHaveClass("border-b");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("hides a section whose child renders nothing, like a closed editor", () => {
|
||||||
|
const Closed = () => null;
|
||||||
|
const { container } = render(
|
||||||
|
<TileStack>
|
||||||
|
<span>first</span>
|
||||||
|
<Closed />
|
||||||
|
</TileStack>,
|
||||||
|
);
|
||||||
|
const sections = container.querySelectorAll(".border-b");
|
||||||
|
expect(sections[sections.length - 1]).toHaveClass("empty:hidden");
|
||||||
|
expect(sections[sections.length - 1]).toBeEmptyDOMElement();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("cards outside a tile layout", () => {
|
describe("cards outside a tile layout", () => {
|
||||||
|
|||||||
Reference in new issue
Block a user