1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-07 23:03:00 +03:00

Added env option for setting dark mode default

Also allowed config-centralised default user settings for this change
and bought existing user-level view options into that default settings
system to be cleaner in code usage.

For #2081
This commit is contained in:
Dan Brown
2021-02-07 23:12:05 +00:00
parent af032f8993
commit b0f4500c34
11 changed files with 40 additions and 19 deletions

View File

@@ -92,4 +92,17 @@ class UserPreferencesTest extends TestCase
$home->assertDontSee('Dark Mode');
$home->assertSee('Light Mode');
}
public function test_dark_mode_defaults_to_config_option()
{
config()->set('setting-defaults.user.dark-mode-enabled', false);
$this->assertEquals(false, setting()->getForCurrentUser('dark-mode-enabled'));
$home = $this->get('/login');
$home->assertElementNotExists('.dark-mode');
config()->set('setting-defaults.user.dark-mode-enabled', true);
$this->assertEquals(true, setting()->getForCurrentUser('dark-mode-enabled'));
$home = $this->get('/login');
$home->assertElementExists('.dark-mode');
}
}