NOW MANAGED ON CODEBERG
Added tests to cover page_move features
Dan Brownbc4978479715
diff --git a/resources/views/pages/move.blade.php b/resources/views/pages/move.blade.phpindex 2c9437e77..5b02c827e 100644--- a/resources/views/pages/move.blade.php+++ b/resources/views/pages/move.blade.php@@ -32,7 +32,7 @@<div class="form-group"><div entity-selector class="entity-selector large" entity-types="book,chapter">- <input type="hidden" entity-selector-input name="entity_selection">+ <input type="hidden" entity-selector-input name="entity_selection" value=""><input type="text" placeholder="Search" ng-model="search" ng-model-options="{debounce: 200}" ng-change="searchEntities()"><div class="text-center loading" ng-show="loading">@include('partials/loading-icon')</div><div ng-show="!loading" ng-bind-html="entityResults"></div>diff --git a/tests/Entity/EntitySearchTest.php b/tests/Entity/EntitySearchTest.phpindex 6b313e7b8..a9d9bc047 100644--- a/tests/Entity/EntitySearchTest.php+++ b/tests/Entity/EntitySearchTest.php@@ -82,4 +82,14 @@ class EntitySearchTest extends TestCase$this->asAdmin()->visit('/search/books?term=' . $book->name)->see('Book Search Results')->see('.entity-list', $book->name);}++ public function test_ajax_entity_search()+ {+ $page = \BookStack\Page::all()->last();+ $notVisitedPage = \BookStack\Page::first();+ $this->visit($page->getUrl());+ $this->asAdmin()->visit('/ajax/search/entities?term=' . $page->name)->see('.entity-list', $page->name);+ $this->asAdmin()->visit('/ajax/search/entities?types=book&term=' . $page->name)->dontSee('.entity-list', $page->name);+ $this->asAdmin()->visit('/ajax/search/entities')->see('.entity-list', $page->name)->dontSee($notVisitedPage->name);+ }}diff --git a/tests/Entity/SortTest.php b/tests/Entity/SortTest.phpindex 8792a0a06..2f2f9109d 100644--- a/tests/Entity/SortTest.php+++ b/tests/Entity/SortTest.php@@ -22,4 +22,22 @@ class SortTest extends TestCase->dontSee($draft->name);}+ public function test_page_move()+ {+ $page = \BookStack\Page::first();+ $currentBook = $page->book;+ $newBook = \BookStack\Book::where('id', '!=', $currentBook->id)->first();+ $this->asAdmin()->visit($page->getUrl() . '/move')+ ->see('Move Page')->see($page->name)+ ->type('book:' . $newBook->id, 'entity_selection')->press('Move Page');++ $page = \BookStack\Page::find($page->id);+ $this->seePageIs($page->getUrl());+ $this->assertTrue($page->book->id == $newBook->id, 'Page book is now the new book');++ $this->visit($newBook->getUrl())+ ->seeInNthElement('.activity-list-item', 0, 'moved page')+ ->seeInNthElement('.activity-list-item', 0, $page->name);+ }+}\ No newline at end of file