diff --git a/resources/views/search/entity-ajax-list.blade.php b/resources/views/search/entity-ajax-list.blade.php
index 93f2633aa..9a146506f 100644
--- a/resources/views/search/entity-ajax-list.blade.php
+++ b/resources/views/search/entity-ajax-list.blade.php
@@ -2,7 +2,7 @@
@if(count($entities) > 0)
@foreach($entities as $index => $entity)
@if($entity->isA('page'))
- @include('pages/list-item', ['page' => $entity])
+ @include('pages/list-item', ['page' => $entity, 'showPath' => true])
@elseif($entity->isA('book'))
@include('books/list-item', ['book' => $entity])
@elseif($entity->isA('chapter'))
diff --git a/tests/Entity/EntitySearchTest.php b/tests/Entity/EntitySearchTest.php
index 94e28e944..587430918 100644
--- a/tests/Entity/EntitySearchTest.php
+++ b/tests/Entity/EntitySearchTest.php
@@ -1,6 +1,9 @@
tags()->saveMany($newTags);
- $pageB = \BookStack\Page::all()->last();
+ $pageB = Page::all()->last();
$pageB->tags()->create(['name' => 'animal', 'value' => 'dog']);
$this->asEditor();
@@ -160,8 +163,8 @@ class EntitySearchTest extends TestCase
public function test_ajax_entity_search()
{
- $page = \BookStack\Page::all()->last();
- $notVisitedPage = \BookStack\Page::first();
+ $page = Page::all()->last();
+ $notVisitedPage = Page::first();
// Visit the page to make popular
$this->asEditor()->get($page->getUrl());
@@ -176,4 +179,20 @@ class EntitySearchTest extends TestCase
$defaultListTest->assertSee($page->name);
$defaultListTest->assertDontSee($notVisitedPage->name);
}
+
+ public function test_ajax_entity_serach_shows_breadcrumbs()
+ {
+ $chapter = Chapter::first();
+ $page = $chapter->pages->first();
+ $this->asEditor();
+
+ $pageSearch = $this->get('/ajax/search/entities?term=' . urlencode($page->name));
+ $pageSearch->assertSee($page->name);
+ $pageSearch->assertSee($chapter->getShortName());
+ $pageSearch->assertSee($page->book->getShortName());
+
+ $chapterSearch = $this->get('/ajax/search/entities?term=' . urlencode($chapter->name));
+ $chapterSearch->assertSee($chapter->name);
+ $chapterSearch->assertSee($chapter->book->getShortName());
+ }
}