/**
 * jsdom fires no CSS transitions, so astryx toasts dismissed via their exit
 * animation (a grid-template-rows transition) never leave the DOM. In a real
 * browser the `transitionend` fires and the viewport removes the entry.
 * Synthesize that completion — same event/name the browser would emit.
 */
export function flushToastExitAnimations() {
  for (const node of Array.from(document.querySelectorAll('[data-toast-id]'))) {
    node.dispatchEvent(
      new TransitionEvent('transitionend', {
        propertyName: 'grid-template-rows',
        bubbles: true,
      }),
    )
  }
}
