diff --git a/ui/src/pages/settings/index.tsx b/ui/src/pages/settings/index.tsx index b01539f2..5d1bf4a1 100644 --- a/ui/src/pages/settings/index.tsx +++ b/ui/src/pages/settings/index.tsx @@ -210,12 +210,7 @@ function SettingsPageInner() { {/* Config Content - scrollable */}
- {rawConfigLoading ? ( -
- - {t('settings.loading')} -
- ) : rawConfig ? ( + {rawConfig ? ( {}} @@ -224,6 +219,11 @@ function SettingsPageInner() { minHeight="auto" className="min-h-full" /> + ) : rawConfigLoading ? ( +
+ + {t('settings.loading')} +
) : (
diff --git a/ui/tests/unit/ui/pages/settings/settings-page.test.tsx b/ui/tests/unit/ui/pages/settings/settings-page.test.tsx new file mode 100644 index 00000000..651a3adb --- /dev/null +++ b/ui/tests/unit/ui/pages/settings/settings-page.test.tsx @@ -0,0 +1,87 @@ +import { beforeEach, describe, expect, it, vi } from 'vitest'; +import type { ReactNode } from 'react'; +import { render, screen } from '@tests/setup/test-utils'; + +const mocks = vi.hoisted(() => ({ + useSettingsTab: vi.fn(), + useRawConfig: vi.fn(), + setActiveTab: vi.fn(), + fetchRawConfig: vi.fn(), + copyToClipboard: vi.fn(), +})); + +vi.mock('@/pages/settings/hooks', () => ({ + useSettingsTab: mocks.useSettingsTab, + useRawConfig: mocks.useRawConfig, +})); + +vi.mock('react-resizable-panels', () => ({ + PanelGroup: ({ children }: { children: ReactNode }) =>
{children}
, + Panel: ({ children }: { children: ReactNode }) =>
{children}
, + PanelResizeHandle: () =>
, +})); + +vi.mock('@/components/shared/code-editor', () => ({ + CodeEditor: ({ value }: { value: string }) => ( +