mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-04-17 10:02:38 +00:00
Added tests and translations for dark-mode components
This commit is contained in:
parent
573c848d51
commit
50669e3f4a
3 changed files with 21 additions and 2 deletions
|
@ -66,6 +66,8 @@ return [
|
|||
'profile_menu' => 'Profile Menu',
|
||||
'view_profile' => 'View Profile',
|
||||
'edit_profile' => 'Edit Profile',
|
||||
'dark_mode' => 'Dark Mode',
|
||||
'light_mode' => 'Light Mode',
|
||||
|
||||
// Layout tabs
|
||||
'tab_info' => 'Info',
|
||||
|
|
|
@ -76,9 +76,9 @@
|
|||
{{ csrf_field() }}
|
||||
{{ method_field('patch') }}
|
||||
@if(setting()->getForCurrentUser('dark-mode-enabled'))
|
||||
<button>@icon('light-mode')Light Mode</button>
|
||||
<button>@icon('light-mode'){{ trans('common.light_mode') }}</button>
|
||||
@else
|
||||
<button>@icon('dark-mode')Dark Mode</button>
|
||||
<button>@icon('dark-mode'){{ trans('common.dark_mode') }}</button>
|
||||
@endif
|
||||
</form>
|
||||
</li>
|
||||
|
|
|
@ -75,4 +75,21 @@ class UserPreferencesTest extends TestCase
|
|||
$invalidKeyRequest = $this->patch('/settings/users/' . $editor->id.'/update-expansion-preference/my-home-details', ['expand' => 'true']);
|
||||
$invalidKeyRequest->assertStatus(500);
|
||||
}
|
||||
|
||||
public function test_toggle_dark_mode()
|
||||
{
|
||||
$home = $this->actingAs($this->getEditor())->get('/');
|
||||
$home->assertElementNotExists('.dark-mode');
|
||||
$home->assertSee('Dark Mode');
|
||||
|
||||
$this->assertEquals(false, setting()->getForCurrentUser('dark-mode-enabled', false));
|
||||
$prefChange = $this->patch('/settings/users/toggle-dark-mode');
|
||||
$prefChange->assertRedirect();
|
||||
$this->assertEquals(true, setting()->getForCurrentUser('dark-mode-enabled'));
|
||||
|
||||
$home = $this->actingAs($this->getEditor())->get('/');
|
||||
$home->assertElementExists('.dark-mode');
|
||||
$home->assertDontSee('Dark Mode');
|
||||
$home->assertSee('Light Mode');
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue