+ $this->withHtml($homeVisit)->assertElementContains('.grid-card', $shelf->name);
+ }
+
+ public function test_books_and_bookshelves_homepage_has_expected_actions()
+ {
+ $this->asEditor();
+
+ foreach (['bookshelves', 'books'] as $homepageType) {
+ $this->setSettings(['app-homepage-type' => $homepageType]);
+
+ $html = $this->withHtml($this->get('/'));
+ $html->assertElementContains('.actions button', 'Dark Mode');
+ $html->assertElementContains('.actions a[href$="/tags"]', 'View Tags');
+ }
+ }
+
+ public function test_shelves_list_homepage_adheres_to_book_visibility_permissions()
+ {
+ $editor = $this->users->editor();
+ setting()->putUser($editor, 'bookshelves_view_type', 'list');
+ $this->setSettings(['app-homepage-type' => 'bookshelves']);
+ $this->asEditor();
+
+ $shelf = $this->entities->shelf();
+ $book = $shelf->books()->first();
+
+ // Ensure initially visible
+ $homeVisit = $this->get('/');
+ $this->withHtml($homeVisit)->assertElementContains('.content-wrap', $shelf->name);
+ $this->withHtml($homeVisit)->assertElementContains('.content-wrap', $book->name);
+
+ // Ensure book no longer visible without view permission
+ $editor->roles()->detach();
+ $this->permissions->grantUserRolePermissions($editor, ['bookshelf-view-all']);
+ $homeVisit = $this->get('/');
+ $this->withHtml($homeVisit)->assertElementContains('.content-wrap', $shelf->name);
+ $this->withHtml($homeVisit)->assertElementNotContains('.content-wrap', $book->name);
+
+ // Ensure is visible again with entity-level view permission
+ $this->permissions->setEntityPermissions($book, ['view'], [$editor->roles()->first()]);
+ $homeVisit = $this->get('/');
+ $this->withHtml($homeVisit)->assertElementContains('.content-wrap', $shelf->name);
+ $this->withHtml($homeVisit)->assertElementContains('.content-wrap', $book->name);
+ }
+
+ public function test_new_users_dont_have_any_recently_viewed()
+ {
+ $user = User::factory()->create();
+ $viewRole = Role::getRole('Viewer');
+ $user->attachRole($viewRole);