mirror of
https://github.com/langgenius/dify.git
synced 2026-03-11 18:17:05 +00:00
fix(account-dropdown): keep menu open when switching theme
This commit is contained in:
@@ -29,6 +29,10 @@ vi.mock('@/app/components/header/github-star', () => ({
|
||||
default: () => <div data-testid="github-star">GithubStar</div>,
|
||||
}))
|
||||
|
||||
vi.mock('@/app/components/base/theme-switcher', () => ({
|
||||
default: () => <button type="button" data-testid="theme-switcher-button">Theme switcher</button>,
|
||||
}))
|
||||
|
||||
vi.mock('@/context/app-context', () => ({
|
||||
useAppContext: vi.fn(),
|
||||
}))
|
||||
@@ -276,6 +280,16 @@ describe('AccountDropdown', () => {
|
||||
// Assert
|
||||
expect(screen.queryByTestId('account-about')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('should keep account dropdown open when clicking the theme switcher', () => {
|
||||
// Act
|
||||
renderWithRouter(<AppSelector />)
|
||||
fireEvent.click(screen.getByRole('button', { name: 'common.account.account' }))
|
||||
fireEvent.click(screen.getByTestId('theme-switcher-button'))
|
||||
|
||||
// Assert
|
||||
expect(screen.getByText('common.userProfile.logout')).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
describe('Branding and Environment', () => {
|
||||
|
||||
@@ -228,8 +228,8 @@ export default function AppSelector() {
|
||||
)}
|
||||
<AccountMenuSection>
|
||||
<DropdownMenuItem
|
||||
closeOnClick={false}
|
||||
className="cursor-default data-[highlighted]:bg-transparent"
|
||||
onSelect={e => e.preventDefault()}
|
||||
>
|
||||
<MenuItemContent
|
||||
iconClassName="i-ri-t-shirt-2-line"
|
||||
|
||||
Reference in New Issue
Block a user