mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-03-24 06:57:26 +08:00
Added tests to cover page_move features
This commit is contained in:
parent
7f99903fdb
commit
bc49784797
@ -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>
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user