From aa6b31317ccdac4d2ba6a2a7d0a93bd5365d60a0 Mon Sep 17 00:00:00 2001 From: Test Date: Mon, 2 Mar 2026 21:51:56 +0100 Subject: [PATCH] chore: sync SidebarParts dragHandle removal from main --- src/components/Sidebar.test.tsx | 65 --------------------------------- 1 file changed, 65 deletions(-) diff --git a/src/components/Sidebar.test.tsx b/src/components/Sidebar.test.tsx index 234a480d..821b1ce2 100644 --- a/src/components/Sidebar.test.tsx +++ b/src/components/Sidebar.test.tsx @@ -766,71 +766,6 @@ describe('Sidebar', () => { }) }) - describe('context menu — customize icon & color', () => { - const onCustomizeType = vi.fn() - - beforeEach(() => { - vi.clearAllMocks() - Object.defineProperty(window, 'innerWidth', { writable: true, configurable: true, value: 1280 }) - Object.defineProperty(window, 'innerHeight', { writable: true, configurable: true, value: 800 }) - }) - - it('shows context menu when right-clicking a section header', () => { - render( {}} onCustomizeType={onCustomizeType} />) - fireEvent.contextMenu(screen.getByText('Projects'), { clientX: 100, clientY: 200 }) - expect(screen.getByText('Customize icon & color…')).toBeInTheDocument() - }) - - it('closes context menu and opens customize popover when clicking menu item', () => { - render( {}} onCustomizeType={onCustomizeType} />) - fireEvent.contextMenu(screen.getByText('Projects'), { clientX: 100, clientY: 200 }) - fireEvent.click(screen.getByText('Customize icon & color…')) - expect(screen.queryByText('Customize icon & color…')).not.toBeInTheDocument() - expect(screen.getByText('Done')).toBeInTheDocument() - }) - - it('calls onCustomizeType when a color is selected in the popover', () => { - render( {}} onCustomizeType={onCustomizeType} />) - fireEvent.contextMenu(screen.getByText('Projects'), { clientX: 100, clientY: 200 }) - fireEvent.click(screen.getByText('Customize icon & color…')) - const colorButtons = screen.getAllByTitle(/red|blue|green|purple|yellow|orange|teal|pink/i) - fireEvent.click(colorButtons[0]) - expect(onCustomizeType).toHaveBeenCalled() - }) - - it('positions context menu above click point when near bottom of viewport', () => { - render( {}} onCustomizeType={onCustomizeType} />) - // Click near the bottom — y=780, menu height=48, so 780+48>800 → flip above - fireEvent.contextMenu(screen.getByText('Projects'), { clientX: 100, clientY: 780 }) - const menu = screen.getByText('Customize icon & color…').parentElement! - const menuTop = parseInt(menu.style.top, 10) - // Should be flipped up to 780-48=732 - expect(menuTop).toBe(732) - }) - - it('positions context menu at click point when not near bottom', () => { - render( {}} onCustomizeType={onCustomizeType} />) - fireEvent.contextMenu(screen.getByText('Projects'), { clientX: 100, clientY: 200 }) - const menu = screen.getByText('Customize icon & color…').parentElement! - expect(parseInt(menu.style.top, 10)).toBe(200) - }) - - it('customize popover appears at clamped position near the right-click point', () => { - render( {}} onCustomizeType={onCustomizeType} />) - fireEvent.contextMenu(screen.getByText('Projects'), { clientX: 100, clientY: 200 }) - fireEvent.click(screen.getByText('Customize icon & color…')) - // Find the popover wrapper div (parent of TypeCustomizePopover content) - const doneButton = screen.getByText('Done') - // Walk up to find the fixed positioned div - let el: HTMLElement | null = doneButton - while (el && !el.style.left) el = el.parentElement - expect(el).not.toBeNull() - // Position should be near (100, 200), clamped to viewport - expect(parseInt(el!.style.left, 10)).toBeGreaterThanOrEqual(8) - expect(parseInt(el!.style.top, 10)).toBeGreaterThanOrEqual(8) - }) - }) - describe('section ordering by type order property', () => { const entriesWithOrder: VaultEntry[] = [ ...mockEntries,