mirror of
https://github.com/langgenius/dify.git
synced 2026-08-30 17:11:50 +08:00
chore: show full agent save time on hover (#41148)
Co-authored-by: yyh <92089059+lyzno1@users.noreply.github.com>
This commit is contained in:
+13
@@ -6,6 +6,7 @@ import type { ComponentProps } from 'react'
|
||||
import type { Mock } from 'vite-plus/test'
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
||||
import { act, fireEvent, render, screen, waitFor, within } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
import { createStore, Provider as JotaiProvider } from 'jotai'
|
||||
import { defaultAgentSoulConfigFormState } from '@/features/agent-v2/agent-composer/form-state'
|
||||
import {
|
||||
@@ -421,6 +422,18 @@ describe('AgentConfigurePublishBar', () => {
|
||||
expect(mockFormatTimeFromNow).toHaveBeenCalledWith(1710000100000)
|
||||
})
|
||||
|
||||
it('should show the complete saved time in a tooltip on hover', async () => {
|
||||
const user = userEvent.setup()
|
||||
renderPublishBar({ draftSavedAt: 1710000100000 })
|
||||
|
||||
const savedTime = screen.getByText(/agentV2\.agentDetail\.configure\.publishBar\.savedAt/)
|
||||
await user.hover(savedTime)
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getAllByText(savedTime.textContent ?? '')).toHaveLength(2)
|
||||
})
|
||||
})
|
||||
|
||||
it('should render published state from the active snapshot and disable publish logic', () => {
|
||||
const { onPublish } = renderPublishBar({
|
||||
activeConfigIsPublished: true,
|
||||
|
||||
+5
-1
@@ -11,6 +11,7 @@ import { Collapsible, CollapsiblePanel } from '@langgenius/dify-ui/collapsible'
|
||||
import { Kbd, KbdGroup } from '@langgenius/dify-ui/kbd'
|
||||
import { StatusDot } from '@langgenius/dify-ui/status-dot'
|
||||
import { toast } from '@langgenius/dify-ui/toast'
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '@langgenius/dify-ui/tooltip'
|
||||
import { formatForDisplay, useHotkey } from '@tanstack/react-hotkeys'
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
||||
import { useAtomValue } from 'jotai'
|
||||
@@ -379,7 +380,10 @@ function PublishBarActions({
|
||||
<span aria-hidden className="shrink-0">
|
||||
·
|
||||
</span>
|
||||
<span className="min-w-0 truncate">{metaLabel}</span>
|
||||
<Tooltip>
|
||||
<TooltipTrigger render={<span className="min-w-0 truncate">{metaLabel}</span>} />
|
||||
<TooltipContent>{metaLabel}</TooltipContent>
|
||||
</Tooltip>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
|
||||
Reference in New Issue
Block a user