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

Search: Updated popular items query, load parent book for chapters/pages

Primarily intended to show parent book for chapters when moving/copying
pages, since the default parent selector interfaces, which used the
entity-selector search endpoint, would run this popular query when no
term was present as a default backup.

For #4264
This commit is contained in:
Dan Brown
2023-06-10 15:08:07 +01:00
parent 777027bc48
commit af0b4fa851
3 changed files with 33 additions and 6 deletions

View File

@ -5,6 +5,7 @@ namespace Tests\Entity;
use BookStack\Activity\Models\Tag;
use BookStack\Entities\Models\Book;
use BookStack\Entities\Models\Bookshelf;
use BookStack\Entities\Models\Chapter;
use Tests\TestCase;
class EntitySearchTest extends TestCase
@ -225,6 +226,17 @@ class EntitySearchTest extends TestCase
$chapterSearch->assertSee($chapter->book->getShortName(42));
}
public function test_entity_selector_shows_breadcrumbs_on_default_view()
{
$page = $this->entities->pageWithinChapter();
$this->asEditor()->get($page->chapter->getUrl());
$resp = $this->asEditor()->get('/search/entity-selector?types=book,chapter&permission=page-create');
$html = $this->withHtml($resp);
$html->assertElementContains('.chapter.entity-list-item', $page->chapter->name);
$html->assertElementContains('.chapter.entity-list-item .entity-item-snippet', $page->book->getShortName(42));
}
public function test_entity_selector_search_reflects_items_without_permission()
{
$page = $this->entities->page();