1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-09 10:22:51 +03:00

Notifications: added user preference UI & logic

Includes testing to cover.
Also added file missing from previous commit.
This commit is contained in:
Dan Brown
2023-07-25 17:06:48 +01:00
parent 45e75edf05
commit 100b28707c
7 changed files with 210 additions and 7 deletions

View File

@@ -45,6 +45,31 @@ class UserPreferencesTest extends TestCase
$this->withHtml($this->get('/'))->assertElementExists('body[component="shortcuts"]');
}
public function test_notification_preferences_updating()
{
$this->asEditor();
// View preferences with defaults
$resp = $this->get('/preferences/notifications');
$resp->assertSee('Notification Preferences');
$html = $this->withHtml($resp);
$html->assertFieldHasValue('preferences[comment-replies]', 'false');
// Update preferences
$resp = $this->put('/preferences/notifications', [
'preferences' => ['comment-replies' => 'true'],
]);
$resp->assertRedirect('/preferences/notifications');
$resp->assertSessionHas('success', 'Notification preferences have been updated!');
// View updates to preferences page
$resp = $this->get('/preferences/notifications');
$html = $this->withHtml($resp);
$html->assertFieldHasValue('preferences[comment-replies]', 'true');
}
public function test_update_sort_preference()
{
$editor = $this->users->editor();