From 8f769deca553bcb120c3d164c2819463bbad8006 Mon Sep 17 00:00:00 2001 From: kifrud Date: Sat, 9 Dec 2023 11:50:09 +0200 Subject: [PATCH] little tweak --- src/core/containerObserver.ts | 9 ++++++--- src/core/toast.cy.tsx | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/core/containerObserver.ts b/src/core/containerObserver.ts index efa68925..b4551ea0 100644 --- a/src/core/containerObserver.ts +++ b/src/core/containerObserver.ts @@ -151,9 +151,12 @@ export function createContainerObserver( const { onClose, children } = toastToRemove.props; if (isFn(onClose)) onClose(isValidElement(children) && children.props); - !closedByButton - ? dispatchChanges(toToastItem(toastToRemove, 'removed')) - : dispatchChanges(toToastItem(toastToRemove, 'removed by button')); + dispatchChanges( + toToastItem( + toastToRemove, + !closedByButton ? 'removed' : 'removed by button' + ) + ); toasts.delete(toastId); closedByButton = false; diff --git a/src/core/toast.cy.tsx b/src/core/toast.cy.tsx index 7ccde44c..e20b3db2 100644 --- a/src/core/toast.cy.tsx +++ b/src/core/toast.cy.tsx @@ -87,7 +87,7 @@ describe('with container', () => { it('remove toast by button', () => { toast.onChange(cy.stub().as('onChange')); - + toast('msg', { data: 'xxxx' }); cy.resolveEntranceAnimation();