Skip to content
Snippets Groups Projects
Unverified Commit 37b84980 authored by Gustavo Saiani's avatar Gustavo Saiani Committed by GitHub
Browse files

Collection sidebar: expand/collapse children when clicking on parent collection name (#17680)

parent 4717d2ff
No related branches found
No related tags found
No related merge requests found
......@@ -91,6 +91,7 @@ function Collection({
// when we click on a link, if there are children,
// expand to show sub collections
function handleClick() {
action(collection.id);
handleToggleMobileSidebar();
}
......
......@@ -3,6 +3,8 @@ import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { DragDropContextProvider } from "react-dnd";
import HTML5Backend from "react-dnd-html5-backend";
import { Router, Route } from "react-router";
import { createMemoryHistory } from "history";
import { PLUGIN_COLLECTIONS } from "metabase/plugins";
......@@ -10,15 +12,22 @@ import CollectionsList from "./CollectionsList";
describe("CollectionsList", () => {
function setup({ collections = [], openCollections = [], ...props } = {}) {
render(
const Page = () => (
<DragDropContextProvider backend={HTML5Backend}>
<CollectionsList
collections={collections}
openCollections={openCollections}
filter={() => true}
handleToggleMobileSidebar={() => false}
{...props}
/>
</DragDropContextProvider>,
</DragDropContextProvider>
);
render(
<Router history={createMemoryHistory()}>
<Route path="/" component={Page} />
</Router>,
);
}
......@@ -67,7 +76,7 @@ describe("CollectionsList", () => {
onOpen,
});
userEvent.click(screen.getByLabelText("chevronright icon"));
userEvent.click(screen.getByText("Parent collection name"));
expect(onOpen).toHaveBeenCalled();
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment