diff --git a/libs/designer-v2/src/lib/ui/FloatingRunButton/__tests__/floatingRunButton.spec.tsx b/libs/designer-v2/src/lib/ui/FloatingRunButton/__tests__/floatingRunButton.spec.tsx index 16afe18edf0..7eeadb572d8 100644 --- a/libs/designer-v2/src/lib/ui/FloatingRunButton/__tests__/floatingRunButton.spec.tsx +++ b/libs/designer-v2/src/lib/ui/FloatingRunButton/__tests__/floatingRunButton.spec.tsx @@ -4,7 +4,7 @@ import '@testing-library/jest-dom/vitest'; import type { ComponentProps } from 'react'; import { describe, it, expect, beforeEach, afterEach, vi, type Mock } from 'vitest'; -import { render, screen, cleanup } from '@testing-library/react'; +import { render, screen, cleanup, fireEvent } from '@testing-library/react'; import { IntlProvider } from 'react-intl'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { Provider } from 'react-redux'; @@ -324,6 +324,17 @@ describe('FloatingRunButton', () => { expect(buttons.length).toBeGreaterThan(1); }); + it('should identify the payload action with a distinct tooltip', async () => { + (LogicAppsShared.canRunBeInvokedWithPayload as Mock).mockReturnValue(true); + + renderWithProviders(defaultProps); + + const payloadButton = screen.getByRole('button', { name: 'Run with payload' }); + fireEvent.focus(payloadButton); + + expect(await screen.findByRole('tooltip')).toHaveTextContent('Run with payload'); + }); + it('should render split button in draft mode even when canRunBeInvokedWithPayload returns false', () => { (LogicAppsShared.canRunBeInvokedWithPayload as Mock).mockReturnValue(false); diff --git a/libs/designer-v2/src/lib/ui/FloatingRunButton/index.tsx b/libs/designer-v2/src/lib/ui/FloatingRunButton/index.tsx index ad2dc7bf2de..5d6507ce1e9 100644 --- a/libs/designer-v2/src/lib/ui/FloatingRunButton/index.tsx +++ b/libs/designer-v2/src/lib/ui/FloatingRunButton/index.tsx @@ -382,6 +382,7 @@ export const FloatingRunButton = ({ ); const [popoverOpen, setPopoverOpen] = useState(false); + const [isPayloadButtonActive, setIsPayloadButtonActive] = useState(false); if (isA2AWorkflow) { return ( @@ -403,7 +404,7 @@ export const FloatingRunButton = ({ if (canBeRunWithPayload) { return (
- + : , + 'aria-label': strings.RUN_PAYLOAD_TOOLTIP, onClick: () => setPopoverOpen(true), + onFocus: () => setIsPayloadButtonActive(true), + onBlur: () => setIsPayloadButtonActive(false), + onMouseEnter: () => setIsPayloadButtonActive(true), + onMouseLeave: () => setIsPayloadButtonActive(false), ref: payloadButtonRef, disabled: isDisabled || runIsLoading || !canBeRunWithPayload || !triggerId, }}