Showing
3 changed files
with
29 additions
and
1 deletions
| ... | @@ -32,7 +32,7 @@ | ... | @@ -32,7 +32,7 @@ |
| 32 | 32 | ||
| 33 | <div class="form-group"> | 33 | <div class="form-group"> |
| 34 | <div entity-selector class="entity-selector large" entity-types="book,chapter"> | 34 | <div entity-selector class="entity-selector large" entity-types="book,chapter"> |
| 35 | - <input type="hidden" entity-selector-input name="entity_selection"> | 35 | + <input type="hidden" entity-selector-input name="entity_selection" value=""> |
| 36 | <input type="text" placeholder="Search" ng-model="search" ng-model-options="{debounce: 200}" ng-change="searchEntities()"> | 36 | <input type="text" placeholder="Search" ng-model="search" ng-model-options="{debounce: 200}" ng-change="searchEntities()"> |
| 37 | <div class="text-center loading" ng-show="loading">@include('partials/loading-icon')</div> | 37 | <div class="text-center loading" ng-show="loading">@include('partials/loading-icon')</div> |
| 38 | <div ng-show="!loading" ng-bind-html="entityResults"></div> | 38 | <div ng-show="!loading" ng-bind-html="entityResults"></div> | ... | ... |
| ... | @@ -82,4 +82,14 @@ class EntitySearchTest extends TestCase | ... | @@ -82,4 +82,14 @@ class EntitySearchTest extends TestCase |
| 82 | $this->asAdmin()->visit('/search/books?term=' . $book->name) | 82 | $this->asAdmin()->visit('/search/books?term=' . $book->name) |
| 83 | ->see('Book Search Results')->see('.entity-list', $book->name); | 83 | ->see('Book Search Results')->see('.entity-list', $book->name); |
| 84 | } | 84 | } |
| 85 | + | ||
| 86 | + public function test_ajax_entity_search() | ||
| 87 | + { | ||
| 88 | + $page = \BookStack\Page::all()->last(); | ||
| 89 | + $notVisitedPage = \BookStack\Page::first(); | ||
| 90 | + $this->visit($page->getUrl()); | ||
| 91 | + $this->asAdmin()->visit('/ajax/search/entities?term=' . $page->name)->see('.entity-list', $page->name); | ||
| 92 | + $this->asAdmin()->visit('/ajax/search/entities?types=book&term=' . $page->name)->dontSee('.entity-list', $page->name); | ||
| 93 | + $this->asAdmin()->visit('/ajax/search/entities')->see('.entity-list', $page->name)->dontSee($notVisitedPage->name); | ||
| 94 | + } | ||
| 85 | } | 95 | } | ... | ... |
| ... | @@ -22,4 +22,22 @@ class SortTest extends TestCase | ... | @@ -22,4 +22,22 @@ class SortTest extends TestCase |
| 22 | ->dontSee($draft->name); | 22 | ->dontSee($draft->name); |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | + public function test_page_move() | ||
| 26 | + { | ||
| 27 | + $page = \BookStack\Page::first(); | ||
| 28 | + $currentBook = $page->book; | ||
| 29 | + $newBook = \BookStack\Book::where('id', '!=', $currentBook->id)->first(); | ||
| 30 | + $this->asAdmin()->visit($page->getUrl() . '/move') | ||
| 31 | + ->see('Move Page')->see($page->name) | ||
| 32 | + ->type('book:' . $newBook->id, 'entity_selection')->press('Move Page'); | ||
| 33 | + | ||
| 34 | + $page = \BookStack\Page::find($page->id); | ||
| 35 | + $this->seePageIs($page->getUrl()); | ||
| 36 | + $this->assertTrue($page->book->id == $newBook->id, 'Page book is now the new book'); | ||
| 37 | + | ||
| 38 | + $this->visit($newBook->getUrl()) | ||
| 39 | + ->seeInNthElement('.activity-list-item', 0, 'moved page') | ||
| 40 | + ->seeInNthElement('.activity-list-item', 0, $page->name); | ||
| 41 | + } | ||
| 42 | + | ||
| 25 | } | 43 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or sign in to post a comment