You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2026/07/06 23:54:35 UTC

(superset) branch test/issue-36132-embedded-tab-anchors created (now 3d7575b5e60)

This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a change to branch test/issue-36132-embedded-tab-anchors
in repository https://gitbox.apache.org/repos/asf/superset.git


      at 3d7575b5e60 test(dashboard): prove activeTabs from permalinks selects tab content (#36132)

This branch includes the following new commits:

     new 3d7575b5e60 test(dashboard): prove activeTabs from permalinks selects tab content (#36132)

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(superset) 01/01: test(dashboard): prove activeTabs from permalinks selects tab content (#36132)

Posted by ru...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch test/issue-36132-embedded-tab-anchors
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 3d7575b5e6092271ca6f7b261170be6240c6ef50
Author: Claude Code <no...@anthropic.com>
AuthorDate: Mon Jul 6 16:53:25 2026 -0700

    test(dashboard): prove activeTabs from permalinks selects tab content (#36132)
    
    Co-Authored-By: Claude Fable 5 <no...@anthropic.com>
---
 .../components/gridComponents/Tabs/Tabs.test.tsx   | 52 ++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/superset-frontend/src/dashboard/components/gridComponents/Tabs/Tabs.test.tsx b/superset-frontend/src/dashboard/components/gridComponents/Tabs/Tabs.test.tsx
index 55bea85deea..c7ed39f2299 100644
--- a/superset-frontend/src/dashboard/components/gridComponents/Tabs/Tabs.test.tsx
+++ b/superset-frontend/src/dashboard/components/gridComponents/Tabs/Tabs.test.tsx
@@ -29,6 +29,7 @@ import DeleteComponentButton from 'src/dashboard/components/DeleteComponentButto
 import getLeafComponentIdFromPath from 'src/dashboard/util/getLeafComponentIdFromPath';
 import emptyDashboardLayout from 'src/dashboard/fixtures/emptyDashboardLayout';
 import React from 'react';
+import { RENDER_TAB_CONTENT } from '../Tab';
 import TabsComponent from './Tabs';
 
 // Cast to accept partial mock props in tests
@@ -264,6 +265,57 @@ test('Switching tabs', () => {
   expect(props.onChangeTab).toHaveBeenCalled();
 });
 
+test('activeTabs hydrated from a permalink selects the matching tab content', () => {
+  // Regression guard for #36132: when a dashboard is opened via a
+  // permalink/anchor (including embedded dashboards), the permalink state is
+  // hydrated into dashboardState.activeTabs. The Tabs component must use that
+  // value to select the matching tab AND render that tab's content panel,
+  // not just highlight the tab header while showing the first tab's content.
+  const props = createProps();
+  props.editMode = false;
+  render(<Tabs {...props} />, {
+    useRedux: true,
+    useDnd: true,
+    initialState: {
+      dashboardState: {
+        activeTabs: ['TAB-YT6eNksV-'],
+      },
+    },
+  });
+
+  // The tab referenced by dashboardState.activeTabs is the selected one
+  const tabs = screen.getAllByRole('tab');
+  expect(tabs[1]).toHaveAttribute('aria-selected', 'true');
+  expect(tabs[0]).toHaveAttribute('aria-selected', 'false');
+
+  // ...and its content panel is the one mounted as visible, while the
+  // default (first) tab's content is not shown
+  const contentCalls = (DashboardComponent as unknown as jest.Mock).mock.calls
+    .map(
+      call =>
+        call[0] as {
+          id: string;
+          renderType: string;
+          isComponentVisible?: boolean;
+        },
+    )
+    .filter(componentProps => componentProps.renderType === RENDER_TAB_CONTENT);
+  expect(
+    contentCalls.some(
+      componentProps =>
+        componentProps.id === 'TAB-YT6eNksV-' &&
+        componentProps.isComponentVisible === true,
+    ),
+  ).toBe(true);
+  expect(
+    contentCalls.some(
+      componentProps =>
+        componentProps.id === 'TAB-AsMaxdYL_t' &&
+        componentProps.isComponentVisible === true,
+    ),
+  ).toBe(false);
+});
+
 test('Call "DashboardComponent.onDropOnTab"', async () => {
   const props = createProps();
   render(<Tabs {...props} />, {