You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by di...@apache.org on 2025/07/25 15:15:24 UTC

(superset) 01/01: fix(NavBar): Add brand text back

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

diegopucci pushed a commit to branch geido/fix/navbar-brand-text
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 1ee2f3da4af5b5702b28fc2f62c81b61f573fce7
Author: Diego Pucci <di...@gmail.com>
AuthorDate: Fri Jul 25 18:14:43 2025 +0300

    fix(NavBar): Add brand text back
---
 superset-frontend/src/features/home/Menu.test.tsx | 39 +++++++++++++++++++++++
 superset-frontend/src/features/home/Menu.tsx      |  5 +++
 2 files changed, 44 insertions(+)

diff --git a/superset-frontend/src/features/home/Menu.test.tsx b/superset-frontend/src/features/home/Menu.test.tsx
index 530a86fbc3..9b8102ee38 100644
--- a/superset-frontend/src/features/home/Menu.test.tsx
+++ b/superset-frontend/src/features/home/Menu.test.tsx
@@ -612,3 +612,42 @@ test('should render an extension component if one is supplied', async () => {
 
   expect(extension[0]).toBeInTheDocument();
 });
+
+test('should render the brand text if available', async () => {
+  useSelectorMock.mockReturnValue({ roles: [] });
+
+  const modifiedProps = {
+    ...mockedProps,
+    data: {
+      ...mockedProps.data,
+      brand: {
+        ...mockedProps.data.brand,
+        text: 'Welcome to Superset',
+      },
+    },
+  };
+
+  render(<Menu {...modifiedProps} />, {
+    useRouter: true,
+    useQueryParams: true,
+    useRedux: true,
+    useTheme: true,
+  });
+
+  const brandText = await screen.findByText('Welcome to Superset');
+  expect(brandText).toBeInTheDocument();
+});
+
+test('should not render the brand text if not available', async () => {
+  useSelectorMock.mockReturnValue({ roles: [] });
+  const text = 'Welcome to Superset';
+  render(<Menu {...mockedProps} />, {
+    useRouter: true,
+    useQueryParams: true,
+    useRedux: true,
+    useTheme: true,
+  });
+
+  const brandText = screen.queryByText(text);
+  expect(brandText).not.toBeInTheDocument();
+});
diff --git a/superset-frontend/src/features/home/Menu.tsx b/superset-frontend/src/features/home/Menu.tsx
index d61bd1e35c..8c2d4eff95 100644
--- a/superset-frontend/src/features/home/Menu.tsx
+++ b/superset-frontend/src/features/home/Menu.tsx
@@ -322,6 +322,11 @@ export function Menu({
           >
             {renderBrand()}
           </Tooltip>
+          {brand.text && (
+            <div className="navbar-brand-text">
+              <span>{brand.text}</span>
+            </div>
+          )}
           <MainNav
             mode={showMenu}
             data-test="navbar-top"