Skip to content

Commit

Permalink
little tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
kifrud committed Dec 9, 2023
1 parent 8fdfe02 commit 8f769de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/core/containerObserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/core/toast.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ describe('with container', () => {

it('remove toast by button', () => {
toast.onChange(cy.stub().as('onChange'));

toast('msg', { data: 'xxxx' });

cy.resolveEntranceAnimation();
Expand Down

0 comments on commit 8f769de

Please sign in to comment.