Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Render the move-questions-into-dashboards modal without a second overlay (#83023)

Denis Berezin63cbcc92e35d
diff --git a/frontend/src/metabase/routes.tsx b/frontend/src/metabase/routes.tsx
index be99f92d14c..42a7e792629 100644
--- a/frontend/src/metabase/routes.tsx
+++ b/frontend/src/metabase/routes.tsx
@@ -361,6 +361,7 @@ export const getRoutes = (store: AppStore): RouteObject[] => [
{modalRoute(
"move-questions-dashboard",
MoveQuestionsIntoDashboardsModal,
+ { noWrap: true },
)}
{PLUGIN_COLLECTIONS.cleanUpRoute}
</>,
diff --git a/frontend/src/metabase/routes.unit.spec.tsx b/frontend/src/metabase/routes.unit.spec.tsx
index a23a1209aea..b41bee0c1f9 100644
--- a/frontend/src/metabase/routes.unit.spec.tsx
+++ b/frontend/src/metabase/routes.unit.spec.tsx
@@ -1,6 +1,10 @@
import { waitFor } from "@testing-library/react";
-import { setupCurrentUserEndpoint } from "__support__/server-mocks";
+import {
+ setupCurrentUserEndpoint,
+ setupDashboardQuestionCandidatesEndpoint,
+ setupUserKeyValueEndpoints,
+} from "__support__/server-mocks";
import { renderRoutes, renderWithProviders, screen } from "__support__/ui";
import { PLUGIN_AUDIT, reinitialize } from "metabase/plugins";
import { Route } from "metabase/router";
@@ -60,6 +64,11 @@ jest.mock("metabase/monitor/components/MonitorLayout", () => {
};
});
+jest.mock("metabase/collections/components/CollectionLanding", () => {
+ const { Outlet } = jest.requireActual("metabase/router");
+ return { __esModule: true, default: () => <Outlet /> };
+});
+
function setupAppRoutes({
initialRoute,
user = createMockUser({ is_superuser: true }),
@@ -152,3 +161,21 @@ describe("application routes", () => {
});
});
});
+
+describe("collection modal routes", () => {
+ it("renders the move-questions-into-dashboards modal with a single dialog", async () => {
+ setupUserKeyValueEndpoints({
+ namespace: "user_acknowledgement",
+ key: "dashboard_question_migration_info_modal",
+ value: false,
+ });
+ setupDashboardQuestionCandidatesEndpoint([]);
+
+ setupAppRoutes({ initialRoute: "/collection/1/move-questions-dashboard" });
+
+ expect(
+ await screen.findByText("Move questions into their dashboards?"),
+ ).toBeInTheDocument();
+ expect(screen.getAllByRole("dialog")).toHaveLength(1);
+ });
+});