Repository navigation
test(layout): pin the "New" badge on a sidebar submenu's parent - #1674
Merged
Merged
Conversation
Follow-up from ansvisor#1603. No test covered the badge on a submenu parent (sidebar.tsx, the expandable item's button): reverting it left every test passing. A render test of the expanded sidebar now finds "New" inside the Content button (data-submenu="/dashboard/content"), and a plain item's (Action Center) too. Removing the parent's badge fails it. The sidebar's heavy parts (brand switcher, profile, theme toggle, the tracked-prompt count) are stubbed; it opens collapsed, so the test expands it through its store. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review follow-up. The test read the real dashboardNav, so it leaned on Action Center and Content being marked "New" today: dropping either badge from the product would fail it for no fault of the sidebar. It now mocks @/config/dashboard with a plain item and a submenu parent, both badged. Removing the badge from the real menu leaves it passing; removing the parent's badge from sidebar.tsx still fails it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
8 of 12 tasks
gkhngyk
approved these changes
Oct 28, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good.
What I checked:
- Own change. Two commits (121880c, 127c499) on 3f6a4d4, test only. It merges cleanly on main (b591947) and with #1670, #1671 and #1675.
- The mocks.
@/config/dashboardis replaced by a menu of its own, and the sidebar only importsdashboardNavfrom it. The other mocked modules are the ones the sidebar reaches that need a session, a store or the network. So the test pins how a badge is drawn, not which items are marked new today. - Tests.
sidebar.test.tsxpasses at the head, and so do the other four files incomponents/layout(18 tests).- With the badge taken out of the submenu parent's button in
sidebar.tsx, the test fails.
This was referenced Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up from #1603: a test pins the "New" badge on a sidebar submenu's parent.
No test covered the badge on a submenu parent (the expandable item's button in
sidebar.tsx); reverting it left every test passing.@/config/dashboardwith its own menu, a plain item and a submenu parent, both badged. It doesn't depend on which product items are marked "New" today.Checked both ways:
sidebar.tsxfails it.Test only, no behaviour change.
Related issue
Follow-up from #1603's review.
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
cd web && npx vitest run src/components/layout/sidebar.test.tsxChecklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)Full checks were run in one tree with this batch's ten follow-up branches merged, and again after the review fixes:
npm test: 246 files, 3,343 tests passed;vitest: 447 files, 4,352 tests passed (after the review fixes).A pre-push review was run on all ten branches.
🤖 Generated with Claude Code