create-mercato-app 0.5.1-develop.3043.1a796c3920 → 0.5.1-develop.3045.b4b3320cc2
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/package.json
CHANGED
|
@@ -10,7 +10,6 @@ import { APP_VERSION } from '@open-mercato/shared/lib/version'
|
|
|
10
10
|
import { parseBooleanWithDefault } from '@open-mercato/shared/lib/boolean'
|
|
11
11
|
import { PageInjectionBoundary } from '@open-mercato/ui/backend/injection/PageInjectionBoundary'
|
|
12
12
|
import { DemoFeedbackWidget } from '@/components/DemoFeedbackWidget'
|
|
13
|
-
import OrganizationSwitcher from '@/components/OrganizationSwitcher'
|
|
14
13
|
import { BackendHeaderChrome } from '@/components/BackendHeaderChrome'
|
|
15
14
|
|
|
16
15
|
registerBackendRouteManifests(backendRoutes)
|
|
@@ -113,7 +112,6 @@ export default async function BackendLayout({
|
|
|
113
112
|
organizationId={auth?.orgId ?? null}
|
|
114
113
|
/>
|
|
115
114
|
)}
|
|
116
|
-
mobileSidebarSlot={<OrganizationSwitcher compact />}
|
|
117
115
|
adminNavApi="/api/auth/admin/nav"
|
|
118
116
|
version={APP_VERSION}
|
|
119
117
|
settingsPathPrefixes={collectStaticSettingsPathPrefixes()}
|
|
@@ -93,9 +93,7 @@ export function BackendHeaderChrome({
|
|
|
93
93
|
missingConfigMessage={missingConfigMessage}
|
|
94
94
|
/>
|
|
95
95
|
) : null}
|
|
96
|
-
<
|
|
97
|
-
{isReady ? <LazyOrganizationSwitcher /> : null}
|
|
98
|
-
</div>
|
|
96
|
+
{isReady ? <LazyOrganizationSwitcher /> : null}
|
|
99
97
|
{showIntegrationsButton ? <IntegrationsButton /> : null}
|
|
100
98
|
<SettingsButton />
|
|
101
99
|
<ProfileDropdown email={email} />
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jest-environment jsdom
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import '@testing-library/jest-dom'
|
|
6
|
+
import { render, screen } from '@testing-library/react'
|
|
7
|
+
import { BackendHeaderChrome } from '../BackendHeaderChrome'
|
|
8
|
+
|
|
9
|
+
jest.mock('next/dynamic', () => (loader: () => Promise<unknown>) => {
|
|
10
|
+
const source = loader.toString()
|
|
11
|
+
const isOrganizationSwitcher = source.includes('OrganizationSwitcher')
|
|
12
|
+
const Lazy = () =>
|
|
13
|
+
isOrganizationSwitcher ? (
|
|
14
|
+
<div data-testid="lazy-organization-switcher" />
|
|
15
|
+
) : (
|
|
16
|
+
<div data-testid="lazy-other" />
|
|
17
|
+
)
|
|
18
|
+
return Lazy
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
jest.mock('@open-mercato/ui/backend/BackendChromeProvider', () => ({
|
|
22
|
+
useBackendChrome: () => ({ payload: { groups: [], grantedFeatures: [] }, isReady: true }),
|
|
23
|
+
}))
|
|
24
|
+
|
|
25
|
+
jest.mock('@open-mercato/ui/backend/IntegrationsButton', () => ({
|
|
26
|
+
IntegrationsButton: () => <div data-testid="integrations-button" />,
|
|
27
|
+
}))
|
|
28
|
+
|
|
29
|
+
jest.mock('@open-mercato/ui/backend/ProfileDropdown', () => ({
|
|
30
|
+
ProfileDropdown: () => <div data-testid="profile-dropdown" />,
|
|
31
|
+
}))
|
|
32
|
+
|
|
33
|
+
jest.mock('@open-mercato/ui/backend/SettingsButton', () => ({
|
|
34
|
+
SettingsButton: () => <div data-testid="settings-button" />,
|
|
35
|
+
}))
|
|
36
|
+
|
|
37
|
+
jest.mock('@/components/AiAssistantShellIntegration', () => ({
|
|
38
|
+
AiAssistantShellIntegration: ({ children }: { children: React.ReactNode }) => <>{children}</>,
|
|
39
|
+
}))
|
|
40
|
+
|
|
41
|
+
describe('BackendHeaderChrome', () => {
|
|
42
|
+
it('renders the organization switcher in the topbar without a viewport-gated wrapper', () => {
|
|
43
|
+
const { container } = render(
|
|
44
|
+
<BackendHeaderChrome
|
|
45
|
+
email="demo@example.com"
|
|
46
|
+
embeddingConfigured={false}
|
|
47
|
+
missingConfigMessage=""
|
|
48
|
+
tenantId={null}
|
|
49
|
+
organizationId={null}
|
|
50
|
+
/>,
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
const switcher = screen.getByTestId('lazy-organization-switcher')
|
|
54
|
+
expect(switcher).toBeInTheDocument()
|
|
55
|
+
|
|
56
|
+
// Regression for issue #1795: the topbar OrganizationSwitcher must not be
|
|
57
|
+
// wrapped in a viewport-gated container that hides it at narrow widths.
|
|
58
|
+
// Previously `<div className="hidden lg:contents">` removed it below 1024px,
|
|
59
|
+
// which combined with `mobileSidebarSlot={<OrganizationSwitcher compact />}`
|
|
60
|
+
// caused the dropdown to reappear inside the mobile sidebar drawer.
|
|
61
|
+
const hiddenWrappers = container.querySelectorAll('.hidden')
|
|
62
|
+
for (const wrapper of Array.from(hiddenWrappers)) {
|
|
63
|
+
expect(wrapper.contains(switcher)).toBe(false)
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
})
|