mirror of
https://github.com/langgenius/dify.git
synced 2026-04-18 04:16:28 +08:00
fix(web): set app card dropdown menu to non-modal (#35302)
This commit is contained in:
parent
c661d5c43a
commit
c3eff6abdc
@ -208,14 +208,16 @@ vi.mock('@/app/components/base/ui/dropdown-menu', () => {
|
|||||||
DropdownMenu: ({
|
DropdownMenu: ({
|
||||||
children,
|
children,
|
||||||
open = false,
|
open = false,
|
||||||
|
modal,
|
||||||
onOpenChange,
|
onOpenChange,
|
||||||
}: {
|
}: {
|
||||||
children: React.ReactNode
|
children: React.ReactNode
|
||||||
open?: boolean
|
open?: boolean
|
||||||
|
modal?: boolean
|
||||||
onOpenChange?: (open: boolean) => void
|
onOpenChange?: (open: boolean) => void
|
||||||
}) => (
|
}) => (
|
||||||
<DropdownMenuContext value={{ isOpen: open, setOpen: onOpenChange ?? vi.fn() }}>
|
<DropdownMenuContext value={{ isOpen: open, setOpen: onOpenChange ?? vi.fn() }}>
|
||||||
<div data-testid="dropdown-menu" data-open={open}>
|
<div data-testid="dropdown-menu" data-open={open} data-modal={modal}>
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
</DropdownMenuContext>
|
</DropdownMenuContext>
|
||||||
@ -461,6 +463,11 @@ describe('AppCard', () => {
|
|||||||
expect(screen.getByTestId('dropdown-menu')).toBeInTheDocument()
|
expect(screen.getByTestId('dropdown-menu')).toBeInTheDocument()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should render dropdown menu as non-modal', () => {
|
||||||
|
render(<AppCard app={mockApp} />)
|
||||||
|
expect(screen.getByTestId('dropdown-menu')).toHaveAttribute('data-modal', 'false')
|
||||||
|
})
|
||||||
|
|
||||||
it('should show edit option when dropdown menu is opened', async () => {
|
it('should show edit option when dropdown menu is opened', async () => {
|
||||||
render(<AppCard app={mockApp} />)
|
render(<AppCard app={mockApp} />)
|
||||||
|
|
||||||
|
|||||||
@ -514,7 +514,7 @@ const AppCard = ({ app, onlineUsers = [], onRefresh }: AppCardProps) => {
|
|||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<div className="mx-1 h-[14px] w-px shrink-0 bg-divider-regular" />
|
<div className="mx-1 h-[14px] w-px shrink-0 bg-divider-regular" />
|
||||||
<DropdownMenu open={isOperationsMenuOpen} onOpenChange={setIsOperationsMenuOpen}>
|
<DropdownMenu modal={false} open={isOperationsMenuOpen} onOpenChange={setIsOperationsMenuOpen}>
|
||||||
<DropdownMenuTrigger
|
<DropdownMenuTrigger
|
||||||
aria-label={t('operation.more', { ns: 'common' })}
|
aria-label={t('operation.more', { ns: 'common' })}
|
||||||
className={cn(
|
className={cn(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user