diff --git a/src/platform/settings/composables/useSettingsDialog.test.ts b/src/platform/settings/composables/useSettingsDialog.test.ts index 4e0636cf0e3..236516fdfc4 100644 --- a/src/platform/settings/composables/useSettingsDialog.test.ts +++ b/src/platform/settings/composables/useSettingsDialog.test.ts @@ -1,11 +1,14 @@ import { computed } from 'vue' +import { cn } from '@comfyorg/tailwind-utils' +import type { DialogContentSize } from '@/components/ui/dialog/dialog.variants' +import { dialogContentVariants } from '@/components/ui/dialog/dialog.variants' import { useBillingContext } from '@/composables/billing/useBillingContext' import { useDialogStore } from '@/stores/dialogStore' /** - * Settings dialog migration regression net: `useSettingsDialog().show()` must - * open the Reka-renderer path with sizing that matches the previous - * `BaseModalLayout size="sm"` (960px × 80vh). Catches accidental reverts of - * the Phase 3 renderer flip. + * Settings dialog regression net: `useSettingsDialog().show()` must open the + * Reka-renderer path at the 1280px design width, capped to the workspace a + * docked Agent panel leaves. Catches accidental reverts of the Phase 3 + * renderer flip and of the workspace-inset cap. */ import { beforeEach, describe, expect, it, vi } from 'vitest' @@ -46,19 +49,59 @@ describe('useSettingsDialog', () => { isCloudRef.value = false }) - it("show() opens the Reka renderer with size 'full' and 1280px content sizing", () => { + const RESERVES_INSET = /var\(--workspace-inset-right,_?0px\)/ + + const resolveAgainstVariant = (args: { + dialogComponentProps: { size: DialogContentSize; contentClass: string } + }): string => + cn( + dialogContentVariants({ + size: args.dialogComponentProps.size, + maximized: false + }), + args.dialogComponentProps.contentClass + ) + + it("show() opens the Reka renderer with size 'full'", () => { useSettingsDialog().show() const [args] = showDialog.mock.calls[0] expect(args.key).toBe('global-settings') expect(args.dialogComponentProps.renderer).toBe('reka') expect(args.dialogComponentProps.size).toBe('full') - expect(args.dialogComponentProps.contentClass).toContain('max-w-[1280px]') - expect(args.dialogComponentProps.contentClass).not.toContain( - 'max-w-[960px]' - ) expect(args.dialogComponentProps.contentClass).toContain('h-[80vh]') }) + it('show() caps both breakpoints at 1280px within the docked Agent panel inset', () => { + useSettingsDialog().show() + const [args] = showDialog.mock.calls[0] + + const survivingCaps = resolveAgainstVariant(args) + .split(' ') + .filter((utility) => /(^|:)max-w-\[/.test(utility)) + + expect(survivingCaps.some((cap) => cap.startsWith('sm:'))).toBe(true) + expect(survivingCaps.some((cap) => !cap.startsWith('sm:'))).toBe(true) + expect( + survivingCaps.filter( + (cap) => !cap.includes('1280px') || !RESERVES_INSET.test(cap) + ) + ).toEqual([]) + }) + + it('show() keeps the workspace-aware centering that the cap is sized for', () => { + useSettingsDialog().show() + const [args] = showDialog.mock.calls[0] + + const horizontalPlacement = resolveAgainstVariant(args) + .split(' ') + .filter((utility) => /(^|:)left-/.test(utility)) + + expect(horizontalPlacement).not.toHaveLength(0) + expect( + horizontalPlacement.filter((utility) => !RESERVES_INSET.test(utility)) + ).toEqual([]) + }) + it('show() uses non-modal Reka so nested PrimeVue dialogs keep focus and pointer events', () => { useSettingsDialog().show() const [args] = showDialog.mock.calls[0] diff --git a/src/platform/settings/composables/useSettingsDialog.ts b/src/platform/settings/composables/useSettingsDialog.ts index c39d7b58b89..35c0feb08a1 100644 --- a/src/platform/settings/composables/useSettingsDialog.ts +++ b/src/platform/settings/composables/useSettingsDialog.ts @@ -7,9 +7,11 @@ import type { SettingPanelType } from '@/platform/settings/types' const DIALOG_KEY = 'global-settings' -// The redesigned Settings dialog is 1280px wide (DES 3253-16079). +// The redesigned Settings dialog is 1280px wide (DES 3253-16079), capped to the +// workspace a docked Agent panel leaves. The `sm:` copy is required: without it +// the `size: 'full'` variant's workspace-only `sm:max-w` drops the 1280px bound. const SETTINGS_CONTENT_CLASS = - 'w-[90vw] max-w-[1280px] sm:max-w-[1280px] h-[80vh] max-h-none rounded-2xl overflow-hidden' + 'w-[90vw] max-w-[min(1280px,calc(100vw-var(--workspace-inset-right,0px)-1rem))] sm:max-w-[min(1280px,calc(100vw-var(--workspace-inset-right,0px)-1rem))] h-[80vh] max-h-none rounded-2xl overflow-hidden' export function useSettingsDialog() { const dialogService = useDialogService()