feat: render flash messages as toasts

Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
frommeandClaude Opus 5 committed 2026-09-18 09:47:20 +02:00
1 parent 5a6db29205
commit 9b35c730ab
9 files changed
+75 -14

No files matched your search

@@ -48,7 +48,7 @@ class HtmxErrorFlashListenerTest extends WebTestCase
self::assertFalse($this->client->getResponse()->headers->has('HX-Retarget'));
$this->client->request('GET', '/');
self::assertSelectorTextContains('#flashes', self::MESSAGE);
self::assertSelectorExists(self::toastSelector(self::MESSAGE));
}
/**
@@ -61,6 +61,15 @@ class HtmxErrorFlashListenerTest extends WebTestCase
self::assertResponseStatusCodeSame(Response::HTTP_FORBIDDEN);
$this->client->request('GET', '/');
self::assertSelectorTextNotContains('#flashes', self::MESSAGE);
self::assertSelectorNotExists('#flashes [data-controller~="toast"]');
}
/**
* A flash carries its text in the Stimulus value that toast_controller hands to Toastify, so
* there is nothing to read as element text -- the element itself stays empty.
*/
private static function toastSelector(string $message): string
{
return \sprintf('#flashes [data-controller~="toast"][data-toast-text-value*="%s"]', $message);
}
}