Files
coolify/tests/Unit/NoNativeBrowserDialogsTest.php
T
Andras BacsaiandClaude Opus 5.5 1f0e2f74d0 fix(ui): replace native browser dialogs with confirmation modals
Use the Coolify confirmation modal instead of wire:confirm for server
management, server transfer and import, resource migration, and S3
backup disabling. Show a toast instead of alert() for a missing GitHub
App webhook endpoint. Add a test that blocks native dialogs in views.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 15:37:20 +02:00

22 lines
680 B
PHP

<?php
use Symfony\Component\Finder\Finder;
it('does not use native browser dialogs in views or scripts', function () {
$files = Finder::create()
->files()
->in([__DIR__.'/../../resources/views', __DIR__.'/../../resources/js'])
->name(['*.blade.php', '*.js']);
$offenders = [];
foreach ($files as $file) {
foreach (explode("\n", $file->getContents()) as $number => $line) {
if (preg_match('/wire:confirm|(?<![\w.$])(?:window\.)?(?:alert|confirm|prompt)\s*\(/', $line)) {
$offenders[] = $file->getRelativePathname().':'.($number + 1);
}
}
}
expect($offenders)->toBeEmpty();
});