From 46bde0a3900cdf9d81cafbe5d9a6408b3e3861fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=BE=D1=80=D0=BE=D0=BB=D0=B5=D0=B2=20=D0=94=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D0=BB?= <105650840+pan1caisreal@users.noreply.github.com> Date: Mon, 12 Aug 2024 13:01:58 +0300 Subject: [PATCH] =?UTF-8?q?bug(UIKIT-1691,PageHeader):=20=D0=98=D1=81?= =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B0=20=D1=80=D0=B0?= =?UTF-8?q?=D0=B1=D0=BE=D1=82=D0=B0=20onClick=20=D1=83=20SecondaryVisibleA?= =?UTF-8?q?ction=20(#1088)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ButtonGroupSecondaryVisibleActions.tsx | 3 +-- .../src/PageHeader/PageHeader.test.tsx | 26 ++++++++++++++++++- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/packages/components/src/PageHeader/ButtonGroup/ButtonGroupSecondaryVisibleActions/ButtonGroupSecondaryVisibleActions.tsx b/packages/components/src/PageHeader/ButtonGroup/ButtonGroupSecondaryVisibleActions/ButtonGroupSecondaryVisibleActions.tsx index dfd88f4f8..53cbeb94e 100644 --- a/packages/components/src/PageHeader/ButtonGroup/ButtonGroupSecondaryVisibleActions/ButtonGroupSecondaryVisibleActions.tsx +++ b/packages/components/src/PageHeader/ButtonGroup/ButtonGroupSecondaryVisibleActions/ButtonGroupSecondaryVisibleActions.tsx @@ -22,8 +22,7 @@ export const ButtonGroupSecondaryVisibleActions = ({ actions, }: ButtonGroupMainActionProps) => { return actions.map((action) => { - const { name, icon, disableReason, disabled, onClick, ...mainProps } = - action; + const { name, icon, disableReason, disabled, ...mainProps } = action; return ( { expect(tooltip).toBeVisible(); expect(tooltip).toHaveTextContent('Отправка по маршруту'); }); + + it('OnClick вызывается при нажатии на вторичные видимые действия', async () => { + const onClickSpy = vi.fn(); + + renderWithTheme( + , + onClick: onClickSpy, + }, + ], + }} + />, + ); + + const button = screen.getByRole('button'); + + await userEvents.click(button); + expect(onClickSpy).toBeCalled(); + }); });