Let the admin choose one of eight colour profiles
Indigo (the default), Blue, Teal, Green, Amber, Rose and Violet in the Vibrant style and Graphite in the Neutral style are generated from config into the stylesheet. Admin settings opens with a colour profile card: a swatch previews the profile on the page, and Save Settings stores it as color_profile, which AppServiceProvider hands to the package's resolver, so every page, mail and error page wears it. An unknown profile is refused, and a saved one that disappears falls back to indigo. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V9NnLxnPp8vaaurb3Z1MFy
This commit is contained in:
co-authored by
Claude Opus 5
parent
27e322c352
commit
21bea9646d
@@ -1,10 +1,12 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Setting;
|
||||
use App\Models\Share;
|
||||
use App\Models\User;
|
||||
use App\Services\ShareService;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use NoNameWeb\LivewireMaterial\Support\Scheme;
|
||||
|
||||
/**
|
||||
* A page of SealShare, once it can be used: loaded, with Alpine and Livewire started.
|
||||
@@ -152,3 +154,25 @@ test('a first visit follows the system theme, and Appearance switches it', funct
|
||||
->assertScript("document.documentElement.dataset.theme === 'light'")
|
||||
->assertScript("localStorage.getItem('sealshare-theme') === 'light'");
|
||||
});
|
||||
|
||||
test('an admin previews a colour profile, saves it, and every page wears it', function () {
|
||||
$this->actingAs(User::factory()->admin()->create());
|
||||
|
||||
$page = ready(visit('/admin/settings'));
|
||||
|
||||
$page->assertScript("document.documentElement.getAttribute('data-scheme') === 'indigo'")
|
||||
->click('[data-test="color-profile"] [data-scheme-option="teal"]')
|
||||
->assertScript("document.documentElement.getAttribute('data-scheme') === 'teal'");
|
||||
|
||||
expect(Setting::get('color_profile'))->toBeNull();
|
||||
|
||||
$page->click('[data-test="save-settings"]')
|
||||
->assertSee('Settings saved successfully.');
|
||||
|
||||
expect(Setting::get('color_profile'))->toBe('teal');
|
||||
|
||||
ready(visit('/upload'))
|
||||
->assertScript("document.documentElement.getAttribute('data-scheme') === 'teal'")
|
||||
->assertScript("getComputedStyle(document.documentElement).getPropertyValue('--md-sys-color-primary').trim() === '".Scheme::profiles()['teal']['light']['primary']."'")
|
||||
->assertNoJavaScriptErrors();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user