Files
coolify/tests/Feature/SettingsDropdownTest.php
Andras BacsaiandClaude Opus 5.5 a79ee909c6 chore: remove unused components and markup-only tests
- Delete Blade components, component classes, Livewire components and
  views that nothing uses after the redesign.
- Delete tests that only compare Blade/CSS source text; keep the source
  checks for authorization gates, stable wire:key values and escaping.
- Update stale tests to the current UI and behaviour.
- Update DESIGN.md to the current navigation and layout.
- Add a lesson: test behaviour, not source markup.

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

80 lines
2.4 KiB
PHP

<?php
use App\Livewire\SettingsDropdown;
use App\Models\User;
use App\Services\ChangelogService;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Auth;
use Livewire\Livewire;
it('renders the changelog modal above the desktop sidebar toggle', function () {
$user = new User(['email' => 'test@example.com']);
$user->id = 1;
Auth::setUser($user);
app()->instance(ChangelogService::class, new class extends ChangelogService
{
public function getEntriesForUser(User $user): Collection
{
return collect([
(object) [
'tag_name' => 'v1.0.0',
'title' => 'Test Release',
'content' => 'Release notes',
'content_html' => '<p>Release notes</p>',
'published_at' => Carbon::parse('2026-05-01'),
'is_read' => false,
],
]);
}
public function getUnreadCountForUser(User $user): int
{
return 1;
}
});
$component = Livewire::test(SettingsDropdown::class, ['trigger' => 'changelog-sidebar'])
->call('openWhatsNewModal')
->assertNotDispatched('whats-new-opened')
->assertSee("What's new", false)
->assertSee('Test Release')
->assertSee('Mark read')
->assertSeeHtml('z-[99]')
->assertSeeHtml('closeWhatsNewModal');
// Single-release layout: no nested card chrome / unread left accent bar
expect($component->html())
->not->toContain('dark:bg-raised')
->not->toContain('w-0.5 bg-accent')
->toContain('absolute right-2 top-2');
});
it('opens the changelog modal when there are no entries', function () {
$user = new User(['email' => 'test@example.com']);
$user->id = 1;
Auth::setUser($user);
app()->instance(ChangelogService::class, new class extends ChangelogService
{
public function getEntriesForUser(User $user): Collection
{
return collect();
}
public function getUnreadCountForUser(User $user): int
{
return 0;
}
});
Livewire::test(SettingsDropdown::class, ['trigger' => 'account-menu'])
->call('openWhatsNewModal')
->assertSet('showWhatsNewModal', true)
->assertSee("What's new", false)
->assertSee('No updates found');
});