Bring back winter snow effect, gated by an admin setting
The site has flip-flopped on the snow effect every winter (add it, remove it, repeat), meaning a PR round-trip each time. Instead, restore the winter.js/is-land assets and gate them behind a new admin-toggleable setting so the effect can be switched on/off from /admin/settings without touching code. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0113BVPXDpEk9HPEqXvSG2WQ
This commit is contained in:
parent
e9d8f4c74b
commit
9532aae37e
18 changed files with 377 additions and 0 deletions
68
tests/Feature/Admin/SettingsTest.php
Normal file
68
tests/Feature/Admin/SettingsTest.php
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\Admin;
|
||||
|
||||
use App\Models\Setting;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use Tests\TestCase;
|
||||
|
||||
class SettingsTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
#[Test]
|
||||
public function admin_settings_page_loads(): void
|
||||
{
|
||||
$user = User::factory()->make();
|
||||
|
||||
$response = $this->actingAs($user)
|
||||
->get('/admin/settings');
|
||||
$response->assertSeeText('Site settings');
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function admin_can_enable_winter_effect(): void
|
||||
{
|
||||
$user = User::factory()->make();
|
||||
|
||||
$this->actingAs($user)
|
||||
->post('/admin/settings', [
|
||||
'_method' => 'PUT',
|
||||
'winter_effect_enabled' => '1',
|
||||
]);
|
||||
$this->assertDatabaseHas('settings', ['winter_effect_enabled' => true]);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function admin_can_disable_winter_effect(): void
|
||||
{
|
||||
$user = User::factory()->make();
|
||||
Setting::factory()->create(['winter_effect_enabled' => true]);
|
||||
|
||||
$this->actingAs($user)
|
||||
->post('/admin/settings', [
|
||||
'_method' => 'PUT',
|
||||
]);
|
||||
$this->assertDatabaseHas('settings', ['winter_effect_enabled' => false]);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function winter_effect_markup_is_hidden_when_disabled(): void
|
||||
{
|
||||
$response = $this->get('/');
|
||||
$response->assertDontSee('snow-fall');
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function winter_effect_markup_is_shown_when_enabled(): void
|
||||
{
|
||||
Setting::factory()->create(['winter_effect_enabled' => true]);
|
||||
|
||||
$response = $this->get('/');
|
||||
$response->assertSee('snow-fall', false);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue