aminghadersohi commented on code in PR #41183:
URL: https://github.com/apache/superset/pull/41183#discussion_r3476331889


##########
superset-frontend/src/features/home/Menu.test.tsx:
##########
@@ -796,3 +796,105 @@ test('brand link falls back to brand.path when theme 
brandLogoUrl is absent', as
   // ensureAppRoot must have been applied: /welcome/ → /superset/welcome/
   expect(brandLink).toHaveAttribute('href', '/superset/welcome/');
 });
+
+// --- Active tab highlighting (regression tests for issue #36403) ---
+//
+// The active top-level tab is highlighted by matching the current route to a
+// menu item. The matching must rely on a stable identifier (the FAB `name`),
+// not the displayed label, otherwise highlighting breaks for any non-English
+// locale where the label is translated.
+
+// Returns the top-level <li> that contains the given visible text, so we can
+// assert whether antd marked it as the selected menu item.
+const getMenuItemByText = (text: string): HTMLElement | null =>
+  screen.getByText(text).closest('li');
+
+afterEach(() => {

Review Comment:
   MEDIUM: `afterEach` declared at module scope (not inside a `describe`) 
applies to **all** tests in `Menu.test.tsx` — including the ~798 lines of 
existing tests above it — not just the three new ones. The path reset is benign 
today, but future test authors won't expect a file-level cleanup hook buried at 
line 812, and any test that checks state after navigation could be silently 
affected.
   
   Wrap the three new `test()` blocks (and this `afterEach` + 
`getMenuItemByText`) inside a `describe('active tab highlighting (regression 
#36403)', () => { … })` so the cleanup is scoped to only these tests.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to