@bevel-software/platform-core-frontend 0.4.1 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD-PARTY-NOTICES.md +5366 -0
- package/package.json +7 -4
- package/src/core/CoreAppShell.tsx +195 -56
- package/src/core/__tests__/AppChrome.test.tsx +125 -0
- package/src/core/__tests__/ShellRoutes.test.tsx +37 -2
- package/src/core/__tests__/bootstrap.test.ts +63 -0
- package/src/core/bootstrap.ts +73 -0
- package/src/core/events.ts +12 -0
- package/src/core/registry.ts +58 -9
- package/src/index.css +100 -11
- package/src/index.ts +24 -23
- package/src/lib/utils.ts +93 -117
- package/src/modules/access/__tests__/ManageAccessDialog.placement.test.tsx +281 -0
- package/src/modules/access/__tests__/ManageAccessDialog.test.tsx +166 -1
- package/src/modules/access/api.ts +49 -0
- package/src/modules/access/components/ManageAccessDialog.tsx +786 -481
- package/src/modules/access/hooks/useFileAccess.ts +1 -1
- package/src/modules/admin/__tests__/AdminRolesPage.suggest.test.tsx +86 -0
- package/src/modules/admin/__tests__/UserAccountsPage.test.tsx +17 -1
- package/src/modules/admin/__tests__/admin.unread.test.tsx +61 -0
- package/src/modules/admin/components/AdminRolesPage.tsx +44 -38
- package/src/modules/admin/components/RolesCorruptedBanner.tsx +11 -10
- package/src/modules/admin/components/UserAccountsPage.tsx +36 -28
- package/src/modules/admin/state/admin.context.tsx +15 -6
- package/src/modules/auth/components/AccountPage.tsx +11 -11
- package/src/modules/auth/components/LoginScreen.tsx +12 -12
- package/src/modules/auth/services/sso.ts +47 -1
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.test.tsx +277 -0
- package/src/modules/change-requests/__tests__/author.test.ts +48 -0
- package/src/modules/change-requests/__tests__/conflict.test.ts +73 -0
- package/src/modules/change-requests/__tests__/diff.test.ts +134 -0
- package/src/modules/change-requests/__tests__/propose.test.ts +93 -0
- package/src/modules/change-requests/__tests__/useFileOnBranch.test.tsx +72 -0
- package/src/modules/change-requests/change-requests.css +22 -0
- package/src/modules/change-requests/components/ChangeBox.tsx +277 -0
- package/src/modules/change-requests/components/ChangeRequestDialog.tsx +713 -0
- package/src/modules/change-requests/components/ConflictHelp.tsx +47 -0
- package/src/modules/change-requests/components/CrFileTree.tsx +398 -0
- package/src/modules/change-requests/components/FileChangeBoxes.tsx +168 -0
- package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +236 -0
- package/src/modules/change-requests/hooks/useCrFileDiffs.ts +79 -0
- package/src/modules/change-requests/hooks/useFileOnBranch.ts +80 -0
- package/src/modules/change-requests/services/change-requests.api.ts +45 -0
- package/src/modules/change-requests/services/propose.api.ts +162 -0
- package/src/modules/change-requests/utils/author.ts +47 -0
- package/src/modules/change-requests/utils/conflict.ts +38 -0
- package/src/modules/change-requests/utils/diff.ts +80 -0
- package/src/modules/git/__tests__/BranchSwitcher.test.tsx +27 -18
- package/src/modules/git/__tests__/FileHistoryPanel.test.tsx +36 -83
- package/src/modules/git/__tests__/PullNeededBanner.test.tsx +5 -5
- package/src/modules/git/__tests__/PullRequestsForMe.test.tsx +147 -0
- package/src/modules/git/__tests__/useAutoPullUpdates.test.tsx +2 -8
- package/src/modules/git/components/BranchSwitcher.tsx +68 -31
- package/src/modules/git/components/DiffView.tsx +4 -4
- package/src/modules/git/components/FileComparisonPanel.tsx +20 -20
- package/src/modules/git/components/FileHistoryPanel.tsx +71 -107
- package/src/modules/git/components/PullNeededBanner.tsx +6 -13
- package/src/modules/git/components/PullRequestsForMe.tsx +71 -36
- package/src/modules/git/components/UnifiedDiffView.tsx +4 -4
- package/src/modules/git/hooks/__tests__/useGitState.deleteBranch.test.tsx +2 -2
- package/src/modules/git/hooks/useGitState.ts +15 -14
- package/src/modules/git/services/__tests__/error-messages.test.ts +4 -4
- package/src/modules/git/services/error-messages.ts +7 -7
- package/src/modules/git/services/git.api.ts +17 -11
- package/src/modules/git/services/pr-prompts.ts +2 -2
- package/src/modules/git/state/git.context.ts +10 -1
- package/src/modules/layout/__tests__/SidebarFrameResponsive.test.tsx +224 -0
- package/src/modules/layout/__tests__/SidebarToggle.test.tsx +242 -0
- package/src/modules/layout/__tests__/breakpoints.test.ts +56 -0
- package/src/modules/layout/breakpoints.ts +6 -0
- package/src/modules/layout/components/AppLayout.tsx +17 -5
- package/src/modules/layout/components/DemoBanner.tsx +10 -1
- package/src/modules/layout/components/MaintenanceOverlay.tsx +3 -3
- package/src/modules/layout/components/MobileChatLayout.tsx +31 -26
- package/src/modules/layout/components/ResizableThreePaneLayout.tsx +59 -24
- package/src/modules/layout/components/SidebarFrame.tsx +317 -0
- package/src/modules/layout/components/SidebarToggle.tsx +86 -0
- package/src/modules/layout/components/SlideOverlay.tsx +1 -1
- package/src/modules/layout/components/__tests__/MobileChatLayout.test.tsx +40 -2
- package/src/modules/layout/components/__tests__/ResizableThreePaneLayout.test.tsx +19 -3
- package/src/modules/layout/state/sidebar.ts +200 -0
- package/src/modules/library/__tests__/AddToGroupDialog.test.tsx +313 -0
- package/src/modules/library/__tests__/ChangeRequestDock.test.tsx +84 -0
- package/src/modules/library/__tests__/GroupJoinRequests.test.tsx +178 -0
- package/src/modules/library/__tests__/GroupPage.test.tsx +479 -0
- package/src/modules/library/__tests__/GroupsIndexPage.test.tsx +283 -0
- package/src/modules/library/__tests__/GroupsSidebar.contextmenu.test.tsx +175 -0
- package/src/modules/library/__tests__/GroupsSidebar.locked.test.tsx +96 -0
- package/src/modules/library/__tests__/GroupsSidebar.test.tsx +142 -0
- package/src/modules/library/__tests__/GroupsSidebarMenu.test.tsx +142 -0
- package/src/modules/library/__tests__/LibraryCard.test.tsx +149 -0
- package/src/modules/library/__tests__/LibraryRoutes.test.tsx +378 -0
- package/src/modules/library/__tests__/LibrarySidebarMenu.test.tsx +347 -0
- package/src/modules/library/__tests__/LockedGroupView.test.tsx +203 -0
- package/src/modules/library/__tests__/NewGroupDialog.test.tsx +114 -0
- package/src/modules/library/__tests__/PersonalAddDialog.test.tsx +177 -0
- package/src/modules/library/__tests__/SkillPage.test.tsx +1063 -0
- package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +259 -0
- package/src/modules/library/__tests__/ToolLogo.test.tsx +63 -0
- package/src/modules/library/__tests__/ToolPage.test.tsx +315 -0
- package/src/modules/library/__tests__/ToolSharePanel.test.tsx +36 -0
- package/src/modules/library/__tests__/ToolVarRow.test.tsx +260 -0
- package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +197 -0
- package/src/modules/library/__tests__/auth-harness.tsx +37 -0
- package/src/modules/library/__tests__/oauth-fragment.test.ts +48 -0
- package/src/modules/library/__tests__/status.test.ts +113 -20
- package/src/modules/library/__tests__/useSkillDetail.test.tsx +102 -0
- package/src/modules/library/__tests__/useToolPage.test.tsx +146 -0
- package/src/modules/library/components/AccessRequestsBanner.tsx +101 -0
- package/src/modules/library/components/AddToGroupDialog.tsx +115 -0
- package/src/modules/library/components/ChangeRequestDock.tsx +52 -28
- package/src/modules/library/components/DeleteGroupDialog.tsx +87 -0
- package/src/modules/library/components/GroupIndexRow.tsx +63 -0
- package/src/modules/library/components/GroupJoinRequests.tsx +56 -0
- package/src/modules/library/components/GroupPage.tsx +373 -0
- package/src/modules/library/components/GroupsIndexPage.tsx +222 -0
- package/src/modules/library/components/GroupsSidebar.tsx +338 -0
- package/src/modules/library/components/GroupsSidebarMenu.tsx +160 -0
- package/src/modules/library/components/LibraryCard.tsx +123 -102
- package/src/modules/library/components/LibraryLayout.tsx +344 -0
- package/src/modules/library/components/LibraryPage.tsx +111 -227
- package/src/modules/library/components/LockGlyph.tsx +31 -0
- package/src/modules/library/components/LockedGroupView.tsx +159 -0
- package/src/modules/library/components/ManagedGroupRequests.tsx +70 -0
- package/src/modules/library/components/NewGroupDialog.tsx +112 -0
- package/src/modules/library/components/NewSkillPanel.tsx +151 -0
- package/src/modules/library/components/PageActions.tsx +156 -0
- package/src/modules/library/components/PendingSkillReview.tsx +63 -0
- package/src/modules/library/components/PersonalAddDialog.tsx +88 -0
- package/src/modules/library/components/PersonalGroupPage.tsx +125 -0
- package/src/modules/library/components/StatusDot.tsx +25 -0
- package/src/modules/library/components/ToolLogo.tsx +171 -0
- package/src/modules/library/components/group-page-parts.tsx +419 -0
- package/src/modules/library/components/skill-page/SkillFileEditor.tsx +134 -0
- package/src/modules/library/components/skill-page/SkillFilePane.tsx +117 -0
- package/src/modules/library/components/skill-page/SkillFileTabs.tsx +112 -0
- package/src/modules/library/components/skill-page/SkillPage.tsx +673 -0
- package/src/modules/library/components/skill-page/tab-ids.ts +33 -0
- package/src/modules/library/components/tool-page/ToolConnectionSection.tsx +175 -0
- package/src/modules/library/components/tool-page/ToolPage.tsx +228 -0
- package/src/modules/library/components/tool-page/ToolSharePanel.tsx +45 -0
- package/src/modules/library/components/tool-page/ToolVarRow.tsx +289 -0
- package/src/modules/library/hooks/useJoinRequests.ts +114 -0
- package/src/modules/library/hooks/useLibraryData.ts +134 -119
- package/src/modules/library/hooks/useSkillDetail.ts +119 -74
- package/src/modules/library/hooks/useToolPage.ts +145 -0
- package/src/modules/library/library.css +33 -245
- package/src/modules/library/routes/LibraryRoutes.tsx +134 -0
- package/src/modules/library/routes/WorkspaceItemRoute.tsx +74 -0
- package/src/modules/library/routes/library-paths.ts +191 -0
- package/src/modules/library/services/groups.api.ts +189 -0
- package/src/modules/library/services/library.api.ts +291 -164
- package/src/modules/library/services/tools.api.ts +60 -0
- package/src/modules/library/state/library-context.ts +22 -0
- package/src/modules/library/state/library-data.tsx +223 -0
- package/src/modules/library/state/toast.context.ts +32 -0
- package/src/modules/library/state/toast.tsx +84 -42
- package/src/modules/library/utils/clipboard.ts +33 -0
- package/src/modules/library/utils/group-summary.ts +68 -0
- package/src/modules/library/utils/names.ts +30 -0
- package/src/modules/library/utils/navigate-external.ts +15 -0
- package/src/modules/library/utils/oauth-fragment.ts +32 -0
- package/src/modules/library/utils/personal-group.ts +36 -0
- package/src/modules/library/utils/status.ts +108 -25
- package/src/modules/library/utils/toast-duration.ts +16 -0
- package/src/modules/onboarding/__tests__/onboarding.test.tsx +533 -0
- package/src/modules/onboarding/agent-clients.ts +48 -0
- package/src/modules/onboarding/components/ConnectAgentPill.tsx +133 -0
- package/src/modules/onboarding/components/RootLanding.tsx +54 -0
- package/src/modules/onboarding/components/WelcomePage.tsx +364 -0
- package/src/modules/onboarding/paths.ts +9 -0
- package/src/modules/onboarding/state/onboarding.ts +191 -0
- package/src/modules/pr/components/OpenChangeRequestDialog.tsx +10 -10
- package/src/modules/pr/services/pr-approvals.api.ts +19 -0
- package/src/modules/pr/services/pr-cancel.api.ts +11 -0
- package/src/modules/review/components/BinaryChangePlaceholder.tsx +3 -3
- package/src/modules/review/components/DiffViewer.tsx +4 -4
- package/src/modules/review/components/MarkdownDiffViewer.tsx +84 -26
- package/src/modules/review/components/ReviewFileRow.tsx +10 -10
- package/src/modules/review/components/ReviewPanel.tsx +49 -17
- package/src/modules/review/components/ReviewPanelSurface.tsx +1 -1
- package/src/modules/review/components/__tests__/MarkdownDiffViewer.test.tsx +122 -0
- package/src/modules/review/hooks/__tests__/useReviewState.test.ts +1 -1
- package/src/modules/secrets-vault/components/ConnectToolsPage.tsx +273 -171
- package/src/modules/secrets-vault/components/SecretsPage.tsx +147 -110
- package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +109 -92
- package/src/modules/secrets-vault/components/__tests__/SecretsPage.test.tsx +35 -4
- package/src/modules/secrets-vault/services/connect.api.ts +24 -3
- package/src/modules/settings/components/DeploymentPage.tsx +90 -0
- package/src/modules/settings/components/SettingsLayout.tsx +135 -0
- package/src/modules/settings/components/SettingsNav.tsx +114 -0
- package/src/modules/settings/components/__tests__/DeploymentPage.test.tsx +110 -0
- package/src/modules/settings/components/__tests__/SettingsLayout.test.tsx +249 -0
- package/src/modules/settings/settings-nav-items.tsx +166 -0
- package/src/modules/setup/__tests__/setup.test.tsx +540 -0
- package/src/modules/setup/components/SetupGate.tsx +67 -0
- package/src/modules/setup/components/SetupScreen.tsx +573 -0
- package/src/modules/setup/services/setup.api.ts +106 -0
- package/src/modules/setup/utils/git-host.ts +34 -0
- package/src/modules/toolbar/components/AppSwitcher.tsx +38 -15
- package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +50 -50
- package/src/modules/toolbar/components/ProfileMenu.tsx +294 -0
- package/src/modules/toolbar/components/Toolbar.tsx +56 -54
- package/src/modules/toolbar/components/__tests__/AppSwitcher.test.tsx +176 -122
- package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +252 -77
- package/src/modules/tools/ToolsExplorerPage.tsx +45 -40
- package/src/modules/workspace/__tests__/design-system-parity.test.ts +133 -0
- package/src/modules/workspace/__tests__/testFixtures.ts +2 -0
- package/src/modules/workspace/components/EditorTabs.tsx +82 -50
- package/src/modules/workspace/components/FileExplorer.tsx +413 -189
- package/src/modules/workspace/components/FilePaneCard.tsx +53 -0
- package/src/modules/workspace/components/FileRoute.tsx +89 -84
- package/src/modules/workspace/components/FileViewer.tsx +700 -294
- package/src/modules/workspace/components/KbDocumentShell.tsx +138 -0
- package/src/modules/workspace/components/KbFileRail.tsx +128 -0
- package/src/modules/workspace/components/KbPageHeader.tsx +390 -0
- package/src/modules/workspace/components/__tests__/EditorTabs.test.tsx +87 -3
- package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +293 -39
- package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +1 -16
- package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +462 -44
- package/src/modules/workspace/components/__tests__/KbDocumentShell.test.tsx +84 -0
- package/src/modules/workspace/components/__tests__/KbFileRail.test.tsx +83 -0
- package/src/modules/workspace/components/__tests__/KbPageHeader.test.tsx +192 -0
- package/src/modules/workspace/components/renderers/CopyAnchorButton.tsx +64 -0
- package/src/modules/workspace/components/renderers/CsvRenderer.tsx +8 -8
- package/src/modules/workspace/components/renderers/DocxRenderer.tsx +18 -9
- package/src/modules/workspace/components/renderers/HtmlRenderer.tsx +14 -14
- package/src/modules/workspace/components/renderers/ImageRenderer.tsx +2 -2
- package/src/modules/workspace/components/renderers/KbMarkdownView.tsx +31 -165
- package/src/modules/workspace/components/renderers/MarkdownRenderer.tsx +18 -5
- package/src/modules/workspace/components/renderers/MermaidDiagram.tsx +27 -10
- package/src/modules/workspace/components/renderers/PdfRenderer.tsx +2 -2
- package/src/modules/workspace/components/renderers/TextRenderer.tsx +11 -5
- package/src/modules/workspace/components/renderers/ToolForm.tsx +24 -24
- package/src/modules/workspace/components/renderers/ToolRenderer.tsx +27 -27
- package/src/modules/workspace/components/renderers/XlsxRenderer.tsx +11 -11
- package/src/modules/workspace/components/renderers/__tests__/DocxRenderer.test.tsx +66 -0
- package/src/modules/workspace/components/renderers/__tests__/KbMarkdownView.test.tsx +17 -1
- package/src/modules/workspace/components/renderers/__tests__/MarkdownRenderer.test.tsx +1 -1
- package/src/modules/workspace/components/renderers/__tests__/MermaidDiagram.test.tsx +58 -0
- package/src/modules/workspace/components/renderers/__tests__/lazyRenderer.test.tsx +68 -0
- package/src/modules/workspace/components/renderers/__tests__/rendererLayout.test.ts +64 -0
- package/src/modules/workspace/components/renderers/__tests__/sanitizeDocxHtml.test.ts +0 -0
- package/src/modules/workspace/components/renderers/chunk-boundary.tsx +71 -0
- package/src/modules/workspace/components/renderers/index.ts +78 -2
- package/src/modules/workspace/components/renderers/kbMarkdownPipeline.tsx +241 -0
- package/src/modules/workspace/components/renderers/lazyRenderer.tsx +59 -0
- package/src/modules/workspace/components/renderers/sanitizeDocxHtml.ts +91 -0
- package/src/modules/workspace/hooks/__tests__/useLinksOut.test.ts +59 -0
- package/src/modules/workspace/hooks/__tests__/useOpenChangeRequests.test.tsx +237 -0
- package/src/modules/workspace/hooks/__tests__/useWorkspaceState.test.tsx +185 -0
- package/src/modules/workspace/hooks/useAutoGrowTextarea.ts +30 -0
- package/src/modules/workspace/hooks/useLastCommit.ts +66 -0
- package/src/modules/workspace/hooks/useLinksOut.ts +56 -0
- package/src/modules/workspace/hooks/useOpenChangeRequests.ts +20 -0
- package/src/modules/workspace/hooks/useWorkspaceState.ts +123 -14
- package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +1 -1
- package/src/modules/workspace/services/workspace.api.ts +9 -2
- package/src/modules/workspace/state/open-change-requests.context.ts +35 -0
- package/src/modules/workspace/state/open-change-requests.tsx +185 -0
- package/src/modules/workspace/state/workspace.context.ts +9 -0
- package/src/modules/workspace/utils/__tests__/diff.test.ts +87 -0
- package/src/modules/workspace/utils/diff.ts +130 -53
- package/src/modules/workspace/utils/fileTree.ts +7 -4
- package/src/modules/workspace/workspace.css +28 -0
- package/src/shared/components/Badge.tsx +62 -0
- package/src/shared/components/Banner.tsx +58 -0
- package/src/shared/components/Button.tsx +90 -0
- package/src/shared/components/Dialog.tsx +6 -6
- package/src/shared/components/Field.tsx +45 -0
- package/src/shared/components/IconButton.tsx +74 -0
- package/src/shared/components/ListRow.tsx +96 -0
- package/src/shared/components/Menu.tsx +88 -0
- package/src/shared/components/PageShell.tsx +8 -5
- package/src/shared/components/Surface.tsx +86 -0
- package/src/shared/components/__tests__/primitives.test.tsx +333 -0
- package/src/shared/components/index.ts +48 -0
- package/src/shared/components/useDismissableMenu.ts +71 -0
- package/src/shared/theme/__tests__/accent-contrast.test.ts +84 -0
- package/src/shared/theme/index.css +12 -0
- package/src/shared/theme/measure.ts +64 -0
- package/src/shared/theme/shadows.css +34 -0
- package/src/shared/theme/tokens.css +193 -0
- package/src/test-setup.ts +9 -0
- package/src/modules/access/components/AccessRestrictedBanner.tsx +0 -31
- package/src/modules/access/components/NodeOwnersBanner.tsx +0 -30
- package/src/modules/git/__tests__/ProtectedBranchBanner.test.tsx +0 -82
- package/src/modules/git/components/ProtectedBranchBanner.tsx +0 -42
- package/src/modules/library/__tests__/DetailDialog.test.tsx +0 -200
- package/src/modules/library/__tests__/diff.test.ts +0 -62
- package/src/modules/library/__tests__/loadout.test.tsx +0 -72
- package/src/modules/library/components/CompareView.tsx +0 -357
- package/src/modules/library/components/DetailDialog.tsx +0 -566
- package/src/modules/library/components/GearIcon.tsx +0 -12
- package/src/modules/library/components/LoadoutSidebar.tsx +0 -156
- package/src/modules/library/components/StatusGem.tsx +0 -21
- package/src/modules/library/components/SuggestChange.tsx +0 -171
- package/src/modules/library/components/particles.ts +0 -50
- package/src/modules/library/state/loadout.tsx +0 -129
- package/src/modules/library/utils/diff.ts +0 -102
- package/src/modules/pr/__tests__/PrApprovalBadge.test.tsx +0 -93
- package/src/modules/pr/__tests__/PrCancelButton.test.tsx +0 -158
- package/src/modules/pr/__tests__/PrCancelConfirmDialog.test.tsx +0 -44
- package/src/modules/pr/__tests__/PrMergeButton.test.tsx +0 -360
- package/src/modules/pr/__tests__/bucketize-comments.test.ts +0 -85
- package/src/modules/pr/__tests__/parsePatch.test.ts +0 -104
- package/src/modules/pr/__tests__/usePrViewerState.test.ts +0 -72
- package/src/modules/pr/components/PrApprovalBadge.tsx +0 -80
- package/src/modules/pr/components/PrCancelButton.tsx +0 -99
- package/src/modules/pr/components/PrCancelConfirmDialog.tsx +0 -119
- package/src/modules/pr/components/PrCommentComposer.tsx +0 -92
- package/src/modules/pr/components/PrCommentThread.tsx +0 -168
- package/src/modules/pr/components/PrCommentsPanel.tsx +0 -143
- package/src/modules/pr/components/PrDiffPane.tsx +0 -425
- package/src/modules/pr/components/PrFileRow.tsx +0 -164
- package/src/modules/pr/components/PrFilesList.tsx +0 -53
- package/src/modules/pr/components/PrHeader.tsx +0 -45
- package/src/modules/pr/components/PrHeaderOverflowMenu.tsx +0 -58
- package/src/modules/pr/components/PrMergeButton.tsx +0 -268
- package/src/modules/pr/components/PrMergeConfirmDialog.tsx +0 -112
- package/src/modules/pr/components/PrRefreshFromTargetButton.tsx +0 -110
- package/src/modules/pr/components/PrViewer.tsx +0 -364
- package/src/modules/pr/hooks/usePrViewerState.ts +0 -150
- package/src/modules/pr/state/pr-viewer.context.ts +0 -34
- package/src/modules/pr/utils/bucketize-comments.ts +0 -55
- package/src/modules/pr/utils/parsePatch.ts +0 -57
- package/src/modules/toolbar/components/AdminMenu.tsx +0 -271
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
-
import {
|
|
1
|
+
import { describe, it, expect, vi, afterEach, beforeEach } from 'vitest';
|
|
2
|
+
import { setSidebarCollapsed } from '../../../layout/state/sidebar';
|
|
3
|
+
import { render, screen, within } from '@testing-library/react';
|
|
3
4
|
import userEvent from '@testing-library/user-event';
|
|
4
5
|
import { MemoryRouter, useLocation } from 'react-router-dom';
|
|
5
6
|
import { Toolbar } from '../Toolbar';
|
|
@@ -14,7 +15,6 @@ import { WorkspaceContext, type WorkspaceContextValue } from '../../../workspace
|
|
|
14
15
|
import { makeWorkspaceFixture } from '../../../workspace/__tests__/testFixtures';
|
|
15
16
|
import { LayoutContext, type LayoutController } from '../../../layout/state/layout.context';
|
|
16
17
|
import { ReviewContext, type ReviewContextValue } from '../../../review/state/review.context';
|
|
17
|
-
import { PrViewerContext, type PrViewerContextValue } from '../../../pr/state/pr-viewer.context';
|
|
18
18
|
import { AdminContext } from '../../../admin/state/admin.context';
|
|
19
19
|
// The gear menu's extension rows (in the enterprise build: Connectors,
|
|
20
20
|
// Watchlist, Routines, Connected apps, feedback, LLM config, user accounts)
|
|
@@ -22,6 +22,7 @@ import { AdminContext } from '../../../admin/state/admin.context';
|
|
|
22
22
|
// one per section, one with a dialog — so the merge/gating/dialog mechanics
|
|
23
23
|
// stay covered without importing enterprise modules.
|
|
24
24
|
import {
|
|
25
|
+
ActiveAppIdContext,
|
|
25
26
|
AppRegistryContext,
|
|
26
27
|
makeRegistry,
|
|
27
28
|
type AdminMenuItem,
|
|
@@ -64,17 +65,15 @@ function renderToolbar(overrides?: {
|
|
|
64
65
|
layout?: Partial<LayoutController>;
|
|
65
66
|
isAdmin?: boolean;
|
|
66
67
|
toolbarItems?: ToolbarItemDef[];
|
|
68
|
+
/** Initial route. */
|
|
69
|
+
route?: string;
|
|
70
|
+
/** The shell-provided active app (see ActiveAppIdContext); the Library
|
|
71
|
+
* sidebar toggle follows this, not the path. */
|
|
72
|
+
activeAppId?: string;
|
|
67
73
|
}) {
|
|
68
74
|
const toggleExplorer = vi.fn();
|
|
69
75
|
const toggleChat = vi.fn();
|
|
70
76
|
const logout = vi.fn();
|
|
71
|
-
const makeCommit = () => ({
|
|
72
|
-
sha: 'abc',
|
|
73
|
-
authorName: 'n',
|
|
74
|
-
authorEmail: 'e',
|
|
75
|
-
subject: 's',
|
|
76
|
-
committedAt: '2026-04-20T00:00:00.000Z',
|
|
77
|
-
});
|
|
78
77
|
|
|
79
78
|
const auth: AuthContextValue = {
|
|
80
79
|
user: {
|
|
@@ -101,9 +100,9 @@ function renderToolbar(overrides?: {
|
|
|
101
100
|
deleteBranch: async () => {},
|
|
102
101
|
pull: async () => {},
|
|
103
102
|
fetchForkBase: async () => null,
|
|
104
|
-
revert: async () => makeCommit(),
|
|
105
103
|
fetchFileHistory: async () => [],
|
|
106
104
|
fetchFileDiff: async () => '',
|
|
105
|
+
fetchFileAtChange: async () => ({ baseline: null, current: null }),
|
|
107
106
|
fetchFileComparison: async () => '',
|
|
108
107
|
...overrides?.git,
|
|
109
108
|
};
|
|
@@ -120,18 +119,6 @@ function renderToolbar(overrides?: {
|
|
|
120
119
|
...overrides?.layout,
|
|
121
120
|
};
|
|
122
121
|
|
|
123
|
-
const prViewer: PrViewerContextValue = {
|
|
124
|
-
openPrNumber: null,
|
|
125
|
-
detail: null,
|
|
126
|
-
notFound: false,
|
|
127
|
-
selectedPath: null,
|
|
128
|
-
isLoading: false,
|
|
129
|
-
lastError: null,
|
|
130
|
-
openPr: () => {},
|
|
131
|
-
closeViewer: () => {},
|
|
132
|
-
selectPath: () => {},
|
|
133
|
-
refresh: async () => {},
|
|
134
|
-
};
|
|
135
122
|
|
|
136
123
|
const review: ReviewContextValue = {
|
|
137
124
|
session: null,
|
|
@@ -149,14 +136,21 @@ function renderToolbar(overrides?: {
|
|
|
149
136
|
clearError: () => {},
|
|
150
137
|
};
|
|
151
138
|
|
|
139
|
+
const route = overrides?.route ?? '/';
|
|
140
|
+
const activeAppId =
|
|
141
|
+
overrides?.activeAppId ??
|
|
142
|
+
(route === '/skills-and-tools' || route.startsWith('/skills-and-tools/')
|
|
143
|
+
? 'skills-tools'
|
|
144
|
+
: undefined);
|
|
145
|
+
|
|
152
146
|
render(
|
|
153
|
-
<MemoryRouter>
|
|
147
|
+
<MemoryRouter initialEntries={[route]}>
|
|
148
|
+
<ActiveAppIdContext.Provider value={activeAppId}>
|
|
154
149
|
<AuthContext.Provider value={auth}>
|
|
155
150
|
<WorkspaceContext.Provider value={workspace}>
|
|
156
151
|
<GitContext.Provider value={git}>
|
|
157
152
|
<AutoUpdateContext.Provider value={overrides?.autoUpdate ?? IDLE_AUTO_UPDATE}>
|
|
158
153
|
<ReviewContext.Provider value={review}>
|
|
159
|
-
<PrViewerContext.Provider value={prViewer}>
|
|
160
154
|
<LayoutContext.Provider value={layout}>
|
|
161
155
|
<AdminContext.Provider
|
|
162
156
|
value={{
|
|
@@ -181,12 +175,12 @@ function renderToolbar(overrides?: {
|
|
|
181
175
|
</AppRegistryContext.Provider>
|
|
182
176
|
</AdminContext.Provider>
|
|
183
177
|
</LayoutContext.Provider>
|
|
184
|
-
</PrViewerContext.Provider>
|
|
185
178
|
</ReviewContext.Provider>
|
|
186
179
|
</AutoUpdateContext.Provider>
|
|
187
180
|
</GitContext.Provider>
|
|
188
181
|
</WorkspaceContext.Provider>
|
|
189
182
|
</AuthContext.Provider>
|
|
183
|
+
</ActiveAppIdContext.Provider>
|
|
190
184
|
</MemoryRouter>,
|
|
191
185
|
);
|
|
192
186
|
|
|
@@ -194,28 +188,30 @@ function renderToolbar(overrides?: {
|
|
|
194
188
|
}
|
|
195
189
|
|
|
196
190
|
describe('Toolbar', () => {
|
|
197
|
-
it('renders
|
|
191
|
+
it('renders sidebar and chat toggles open when their panels are open', () => {
|
|
192
|
+
setSidebarCollapsed(false);
|
|
198
193
|
renderToolbar();
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
layout: { isExplorerCollapsed: true, isChatCollapsed: true },
|
|
208
|
-
});
|
|
209
|
-
const explorerBtn = screen.getByRole('button', { name: /show file explorer/i });
|
|
210
|
-
const chatBtn = screen.getByRole('button', { name: /show chat panel/i });
|
|
211
|
-
expect(explorerBtn).toHaveAttribute('aria-pressed', 'false');
|
|
212
|
-
expect(chatBtn).toHaveAttribute('aria-pressed', 'false');
|
|
194
|
+
expect(screen.getByRole('button', { name: 'Hide sidebar' })).toHaveAttribute(
|
|
195
|
+
'aria-expanded',
|
|
196
|
+
'true',
|
|
197
|
+
);
|
|
198
|
+
expect(screen.getByRole('button', { name: /hide chat panel/i })).toHaveAttribute(
|
|
199
|
+
'aria-pressed',
|
|
200
|
+
'true',
|
|
201
|
+
);
|
|
213
202
|
});
|
|
214
203
|
|
|
215
|
-
it('
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
expect(
|
|
204
|
+
it('reflects collapsed state in the labels', () => {
|
|
205
|
+
setSidebarCollapsed(true);
|
|
206
|
+
renderToolbar({ layout: { isChatCollapsed: true } });
|
|
207
|
+
expect(screen.getByRole('button', { name: 'Show sidebar' })).toHaveAttribute(
|
|
208
|
+
'aria-expanded',
|
|
209
|
+
'false',
|
|
210
|
+
);
|
|
211
|
+
expect(screen.getByRole('button', { name: /show chat panel/i })).toHaveAttribute(
|
|
212
|
+
'aria-pressed',
|
|
213
|
+
'false',
|
|
214
|
+
);
|
|
219
215
|
});
|
|
220
216
|
|
|
221
217
|
it('calls toggleChat when the chat button is clicked', async () => {
|
|
@@ -224,9 +220,9 @@ describe('Toolbar', () => {
|
|
|
224
220
|
expect(toggleChat).toHaveBeenCalledTimes(1);
|
|
225
221
|
});
|
|
226
222
|
|
|
227
|
-
it('renders
|
|
223
|
+
it('renders the profile trigger but NO branch picker. The core toolbar carries only registry items', () => {
|
|
228
224
|
renderToolbar();
|
|
229
|
-
expect(screen.getByRole('button', { name:
|
|
225
|
+
expect(screen.getByRole('button', { name: 'Test User' })).toBeInTheDocument();
|
|
230
226
|
// The branch switcher left the core toolbar: it is an enterprise
|
|
231
227
|
// toolbarItem contribution, scoped by the item itself to the Knowledge
|
|
232
228
|
// app. The git module still ships the component; the shell doesn't
|
|
@@ -256,12 +252,11 @@ describe('Toolbar', () => {
|
|
|
256
252
|
).toBeNull();
|
|
257
253
|
});
|
|
258
254
|
|
|
259
|
-
it('shows the
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
expect(toggleExplorer).toHaveBeenCalledTimes(1);
|
|
255
|
+
it('shows the sidebar toggle and flips the shared state when canToggleExplorer is true', async () => {
|
|
256
|
+
setSidebarCollapsed(false);
|
|
257
|
+
renderToolbar({ layout: { canToggleExplorer: true } });
|
|
258
|
+
await userEvent.click(screen.getByRole('button', { name: 'Hide sidebar' }));
|
|
259
|
+
expect(screen.getByRole('button', { name: 'Show sidebar' })).toBeInTheDocument();
|
|
265
260
|
});
|
|
266
261
|
|
|
267
262
|
it('hides the chat toggle when canToggleChat is false', () => {
|
|
@@ -279,75 +274,255 @@ describe('Toolbar', () => {
|
|
|
279
274
|
expect(toggleChat).toHaveBeenCalledTimes(1);
|
|
280
275
|
});
|
|
281
276
|
|
|
277
|
+
// ONE nav toggle, first in the row and left of the brand, for the app's ONE
|
|
278
|
+
// sidebar. There were two buttons here — same glyph, same spot, different
|
|
279
|
+
// state — until Knowledge's file tree and the Library's group list became
|
|
280
|
+
// the same sidebar.
|
|
281
|
+
describe('sidebar toggle', () => {
|
|
282
|
+
beforeEach(() => setSidebarCollapsed(false));
|
|
283
|
+
|
|
284
|
+
it('flips the shared collapse state on the Library', async () => {
|
|
285
|
+
renderToolbar({ route: '/skills-and-tools', layout: { canToggleExplorer: false } });
|
|
286
|
+
const btn = screen.getByRole('button', { name: 'Hide sidebar' });
|
|
287
|
+
expect(btn).toHaveAttribute('aria-expanded', 'true');
|
|
288
|
+
await userEvent.click(btn);
|
|
289
|
+
expect(
|
|
290
|
+
screen.getByRole('button', { name: 'Show sidebar' }),
|
|
291
|
+
).toHaveAttribute('aria-expanded', 'false');
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
// Three surfaces answer "do I have a sidebar?" two ways — Knowledge
|
|
295
|
+
// declares a `sidebar` pane, the Library and the settings pages are known
|
|
296
|
+
// by their paths — but there is only ever ONE button, never one per
|
|
297
|
+
// surface. The settings case is what catches anyone adding a second,
|
|
298
|
+
// settings-specific toggle instead of reusing SidebarToggle.
|
|
299
|
+
it.each([
|
|
300
|
+
['the Library, by active app', '/skills-and-tools', false, undefined],
|
|
301
|
+
['Knowledge, by its sidebar pane', '/workspace/main', true, undefined],
|
|
302
|
+
['both at once, without doubling up', '/skills-and-tools', true, undefined],
|
|
303
|
+
['a settings page, by its route table', '/secrets', false, undefined],
|
|
304
|
+
// The regression this predicate change exists for: a skill page at its
|
|
305
|
+
// canonical /workspace URL claims Skills & Tools, and the toggle must
|
|
306
|
+
// follow the claim — the old path test made it vanish here.
|
|
307
|
+
[
|
|
308
|
+
'a canonical /workspace item URL, by the claimed app',
|
|
309
|
+
'/workspace/main/knowledge-base/Groups/Sales/create-sales-deck/SKILL.md',
|
|
310
|
+
false,
|
|
311
|
+
'skills-tools',
|
|
312
|
+
],
|
|
313
|
+
] as const)('renders exactly one toggle on %s', (_name, route, canToggleExplorer, activeAppId) => {
|
|
314
|
+
renderToolbar({ route, layout: { canToggleExplorer }, activeAppId });
|
|
315
|
+
expect(screen.getAllByRole('button', { name: /(hide|show) sidebar/i })).toHaveLength(1);
|
|
316
|
+
// The separate "file explorer" button is gone — it was this same button.
|
|
317
|
+
expect(screen.queryByRole('button', { name: /file explorer/i })).toBeNull();
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
// This used to assert the opposite, at this same route — which was the bug
|
|
321
|
+
// written down as a test: /secrets had no nav, so it had nothing to
|
|
322
|
+
// toggle. There is no nav-less surface below the toolbar any more, so
|
|
323
|
+
// there is no negative case left to pin — `/` only ever redirects, and
|
|
324
|
+
// both places it can land (Knowledge, or onboarding's welcome page, which
|
|
325
|
+
// lives inside the Library surface) carry a sidebar.
|
|
326
|
+
//
|
|
327
|
+
// `/secrets/` is the same page: React Router matches the trailing slash to
|
|
328
|
+
// the route declared without one, so the nav is mounted and the toggle
|
|
329
|
+
// must appear. Comparing the raw pathname against the settings paths said
|
|
330
|
+
// otherwise, and a settings page with a sidebar and no way to reopen it is
|
|
331
|
+
// the original bug wearing one extra character.
|
|
332
|
+
it.each(['/secrets', '/secrets/'])(
|
|
333
|
+
'renders on a settings page at %s, which has a nav now',
|
|
334
|
+
(route) => {
|
|
335
|
+
renderToolbar({ route, layout: { canToggleExplorer: false } });
|
|
336
|
+
expect(
|
|
337
|
+
screen.getByRole('button', { name: /(hide|show) sidebar/i }),
|
|
338
|
+
).toBeInTheDocument();
|
|
339
|
+
},
|
|
340
|
+
);
|
|
341
|
+
|
|
342
|
+
// The other half of that pair. Below `md` the settings layout mounts no
|
|
343
|
+
// SidebarFrame at all — the nav is a strip inside the page — so a toggle
|
|
344
|
+
// here would point `aria-controls` at an element that does not exist.
|
|
345
|
+
// Nothing else in this file controls the media query, so without this the
|
|
346
|
+
// `&& !isCompact` clause is only ever exercised in its false branch.
|
|
347
|
+
describe('below the md breakpoint', () => {
|
|
348
|
+
afterEach(() => vi.unstubAllGlobals());
|
|
349
|
+
|
|
350
|
+
const stubCompact = () =>
|
|
351
|
+
vi.stubGlobal(
|
|
352
|
+
'matchMedia',
|
|
353
|
+
vi.fn().mockImplementation((query: string) => ({
|
|
354
|
+
matches: true,
|
|
355
|
+
media: query,
|
|
356
|
+
addEventListener: vi.fn(),
|
|
357
|
+
removeEventListener: vi.fn(),
|
|
358
|
+
})),
|
|
359
|
+
);
|
|
360
|
+
|
|
361
|
+
it('does not render on a settings page, which has no frame to control', () => {
|
|
362
|
+
stubCompact();
|
|
363
|
+
renderToolbar({ route: '/secrets', layout: { canToggleExplorer: false } });
|
|
364
|
+
expect(screen.queryByRole('button', { name: /(hide|show) sidebar/i })).toBeNull();
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
// Only the settings clause is compact-gated. Knowledge keeps its frame
|
|
368
|
+
// at every width, so suppressing its toggle here would be a regression
|
|
369
|
+
// in the other direction.
|
|
370
|
+
it('still renders where the surface declares a sidebar pane', () => {
|
|
371
|
+
stubCompact();
|
|
372
|
+
renderToolbar({ route: '/workspace/main', layout: { canToggleExplorer: true } });
|
|
373
|
+
expect(
|
|
374
|
+
screen.getByRole('button', { name: /(hide|show) sidebar/i }),
|
|
375
|
+
).toBeInTheDocument();
|
|
376
|
+
});
|
|
377
|
+
});
|
|
378
|
+
});
|
|
379
|
+
|
|
282
380
|
// The "Reconciling with the team…" status pill is gone with the
|
|
283
381
|
// pending-commits queue refactor — push failures are handled silently
|
|
284
382
|
// by the background recovery agent now, so there's nothing user-facing
|
|
285
383
|
// to render. The Toolbar no longer mounts a `role="status"` element
|
|
286
384
|
// and the resolution context was deleted entirely.
|
|
287
385
|
|
|
288
|
-
// The
|
|
289
|
-
// all-user rows show for everyone;
|
|
290
|
-
|
|
386
|
+
// The profile menu consolidates every former sidebar-footer entry, plus the
|
|
387
|
+
// three top-bar controls it replaced. The all-user rows show for everyone;
|
|
388
|
+
// the "Admin only" section is gated.
|
|
389
|
+
describe('profile menu', () => {
|
|
291
390
|
async function openMenu() {
|
|
292
|
-
await userEvent.click(screen.getByRole('button', { name:
|
|
391
|
+
await userEvent.click(screen.getByRole('button', { name: 'Test User' }));
|
|
293
392
|
}
|
|
294
393
|
|
|
394
|
+
// The panel is a labelled GROUP of buttons, not a `role="menu"`: it has no
|
|
395
|
+
// arrow-key navigation, so claiming the menu role would promise a keyboard
|
|
396
|
+
// model it does not implement. Every assertion below is the one it always
|
|
397
|
+
// was; only the selector moved.
|
|
398
|
+
const panel = () => screen.getByRole('group', { name: 'You and your settings' });
|
|
399
|
+
const rows = () => within(panel()).getAllByRole('button');
|
|
400
|
+
const row = (name: string | RegExp) => within(panel()).getByRole('button', { name });
|
|
401
|
+
const noRow = (name: string | RegExp) => within(panel()).queryByRole('button', { name });
|
|
402
|
+
const panelGone = () =>
|
|
403
|
+
screen.queryByRole('group', { name: 'You and your settings' });
|
|
404
|
+
|
|
405
|
+
// One button, not three. The name used to be an inert span between the
|
|
406
|
+
// gear and the sign-out arrow — three controls for one question.
|
|
407
|
+
it('collapses the name, the gear and the sign-out arrow into a single trigger', () => {
|
|
408
|
+
renderToolbar();
|
|
409
|
+
expect(screen.queryByRole('button', { name: /^menu/i })).toBeNull();
|
|
410
|
+
expect(screen.queryByRole('button', { name: /sign out/i })).toBeNull();
|
|
411
|
+
// A disclosure, not a menu button. `aria-haspopup="true"` is a synonym
|
|
412
|
+
// for `"menu"`, and the panel is a `group` of ordinary buttons with no
|
|
413
|
+
// roving arrow-key model — so the trigger must NOT claim one.
|
|
414
|
+
const trigger = screen.getByRole('button', { name: 'Test User' });
|
|
415
|
+
expect(trigger).not.toHaveAttribute('aria-haspopup');
|
|
416
|
+
expect(trigger).toHaveAttribute('aria-expanded', 'false');
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
// The pill says the first name; the full one is the accessible name and
|
|
420
|
+
// sits in the panel's identity block. Asserting the text exists catches a
|
|
421
|
+
// name missing from the DOM — it cannot catch one hidden by CSS, since
|
|
422
|
+
// happy-dom applies no stylesheet. That failure mode has bitten once
|
|
423
|
+
// already (`sm:not-sr-only` compiles to nothing under Tailwind v4), so
|
|
424
|
+
// the trigger deliberately carries no class Tailwind can silently drop.
|
|
425
|
+
it('shows the first name beside the avatar', () => {
|
|
426
|
+
renderToolbar();
|
|
427
|
+
const trigger = screen.getByRole('button', { name: 'Test User' });
|
|
428
|
+
expect(trigger).toHaveTextContent('Test');
|
|
429
|
+
expect(trigger).not.toHaveTextContent('Test User');
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
// Identity first: the menu says who you are before offering to change
|
|
433
|
+
// anything. The email is real, unlike the prototype's fabricated one.
|
|
434
|
+
it('states who you are at the top of the panel', async () => {
|
|
435
|
+
renderToolbar();
|
|
436
|
+
await openMenu();
|
|
437
|
+
const menu = panel();
|
|
438
|
+
expect(within(menu).getByText('Test User')).toBeInTheDocument();
|
|
439
|
+
expect(within(menu).getByText('user@example.com')).toBeInTheDocument();
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
it('signs you out from the last row and nowhere else', async () => {
|
|
443
|
+
const { logout } = renderToolbar();
|
|
444
|
+
await openMenu();
|
|
445
|
+
const openRows = rows();
|
|
446
|
+
expect(openRows[openRows.length - 1]).toHaveTextContent('Sign out');
|
|
447
|
+
await userEvent.click(row('Sign out'));
|
|
448
|
+
expect(logout).toHaveBeenCalledTimes(1);
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
// Nothing in the menu means anything without a person, and the trigger is
|
|
452
|
+
// that person — so signed out there is no button at all.
|
|
453
|
+
it('renders nothing when there is no signed-in user', () => {
|
|
454
|
+
renderToolbar({ auth: { user: null } });
|
|
455
|
+
expect(screen.queryByRole('button', { name: /sign out|test user/i })).toBeNull();
|
|
456
|
+
});
|
|
457
|
+
|
|
295
458
|
it('shows the all-user rows (core + registry) to a non-admin and hides the Admin only section', async () => {
|
|
296
459
|
renderToolbar({ isAdmin: false });
|
|
297
460
|
await openMenu();
|
|
298
461
|
// Registry-contributed row merged with the core rows.
|
|
299
|
-
expect(
|
|
300
|
-
expect(
|
|
301
|
-
expect(
|
|
302
|
-
expect(
|
|
303
|
-
expect(screen.getByRole('menuitem', { name: 'Browse available tools' })).toBeInTheDocument();
|
|
462
|
+
expect(row('Stub extension')).toBeInTheDocument();
|
|
463
|
+
expect(row('External agent access')).toBeInTheDocument();
|
|
464
|
+
expect(row('Secrets')).toBeInTheDocument();
|
|
465
|
+
expect(row('Browse available tools')).toBeInTheDocument();
|
|
304
466
|
// Admin only section + its rows are hidden for non-admins.
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
467
|
+
// Scoped to the panel: the settings nav renders this same string, and
|
|
468
|
+
// an unscoped query would throw on multiple matches the day a test
|
|
469
|
+
// mounts both. This harness never does — that is why it passes today —
|
|
470
|
+
// but the trap is now real enough to be worth closing.
|
|
471
|
+
expect(within(panel()).queryByText('Admin only')).toBeNull();
|
|
472
|
+
expect(noRow(/Roles/)).toBeNull();
|
|
473
|
+
expect(noRow('Stub admin row')).toBeNull();
|
|
474
|
+
});
|
|
475
|
+
|
|
476
|
+
// Skills & Tools is an APP, and apps live in the app switcher — which
|
|
477
|
+
// already lists it AND marks it as current. Carrying it here too gave one
|
|
478
|
+
// destination two front doors, only one of which could tell you that you
|
|
479
|
+
// were already standing behind it.
|
|
480
|
+
it('does not offer Skills & Tools, which belongs to the app switcher', async () => {
|
|
481
|
+
renderToolbar();
|
|
482
|
+
await openMenu();
|
|
483
|
+
expect(noRow(/Skills & Tools/)).toBeNull();
|
|
308
484
|
});
|
|
309
485
|
|
|
310
486
|
it('shows the Admin only section with its rows to an admin', async () => {
|
|
311
487
|
renderToolbar({ isAdmin: true });
|
|
312
488
|
await openMenu();
|
|
313
|
-
expect(
|
|
314
|
-
expect(
|
|
315
|
-
expect(
|
|
489
|
+
expect(within(panel()).getByText('Admin only')).toBeInTheDocument();
|
|
490
|
+
expect(row(/Roles/)).toBeInTheDocument();
|
|
491
|
+
expect(row('Stub admin row')).toBeInTheDocument();
|
|
316
492
|
// All-user rows are still present alongside the admin ones.
|
|
317
|
-
expect(
|
|
493
|
+
expect(row('Stub extension')).toBeInTheDocument();
|
|
318
494
|
});
|
|
319
495
|
|
|
320
496
|
// Core rows all NAVIGATE — the settings surfaces are standalone routed
|
|
321
497
|
// pages below the persistent toolbar, not dialogs.
|
|
322
498
|
it('navigates to the standalone settings pages from the core rows and closes the menu', async () => {
|
|
323
499
|
renderToolbar();
|
|
324
|
-
for (const [
|
|
500
|
+
for (const [label, path] of [
|
|
325
501
|
['External agent access', '/external-agent-access'],
|
|
326
502
|
['Secrets', '/secrets'],
|
|
327
503
|
['Browse available tools', '/tools'],
|
|
328
|
-
['Skills & Tools', '/skills-and-tools'],
|
|
329
504
|
] as const) {
|
|
330
505
|
await openMenu();
|
|
331
|
-
await userEvent.click(
|
|
506
|
+
await userEvent.click(row(label));
|
|
332
507
|
expect(screen.getByTestId('pathname')).toHaveTextContent(path);
|
|
333
|
-
expect(
|
|
508
|
+
expect(panelGone()).toBeNull();
|
|
334
509
|
}
|
|
335
510
|
});
|
|
336
511
|
|
|
337
512
|
it('navigates to /roles-and-members from the admin row', async () => {
|
|
338
513
|
renderToolbar({ isAdmin: true });
|
|
339
514
|
await openMenu();
|
|
340
|
-
await userEvent.click(
|
|
515
|
+
await userEvent.click(row('Roles & Members'));
|
|
341
516
|
expect(screen.getByTestId('pathname')).toHaveTextContent('/roles-and-members');
|
|
342
|
-
expect(
|
|
517
|
+
expect(panelGone()).toBeNull();
|
|
343
518
|
});
|
|
344
519
|
|
|
345
520
|
it('opens a registry-contributed dialog from its row and closes the menu', async () => {
|
|
346
521
|
renderToolbar();
|
|
347
522
|
await openMenu();
|
|
348
|
-
await userEvent.click(
|
|
523
|
+
await userEvent.click(row('Stub extension'));
|
|
349
524
|
expect(await screen.findByRole('dialog', { name: 'Stub extension' })).toBeInTheDocument();
|
|
350
|
-
expect(
|
|
525
|
+
expect(panelGone()).toBeNull();
|
|
351
526
|
});
|
|
352
527
|
});
|
|
353
528
|
});
|