Removed test web route, extracted text, added test
This commit is contained in:
parent
8f90996cef
commit
e6e6d25974
4 changed files with 18 additions and 9 deletions
|
@ -24,6 +24,7 @@ return [
|
||||||
'meta_updated_name' => 'Updated :timeLength by :user',
|
'meta_updated_name' => 'Updated :timeLength by :user',
|
||||||
'meta_owned_name' => 'Owned by :user',
|
'meta_owned_name' => 'Owned by :user',
|
||||||
'entity_select' => 'Entity Select',
|
'entity_select' => 'Entity Select',
|
||||||
|
'entity_select_lack_permission' => 'You don\'t have the required permissions to select this item',
|
||||||
'images' => 'Images',
|
'images' => 'Images',
|
||||||
'my_recent_drafts' => 'My Recent Drafts',
|
'my_recent_drafts' => 'My Recent Drafts',
|
||||||
'my_recently_viewed' => 'My Recently Viewed',
|
'my_recently_viewed' => 'My Recently Viewed',
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
@if($locked ?? false)
|
@if($locked ?? false)
|
||||||
<div class="text-warn my-xxs bold">
|
<div class="text-warn my-xxs bold">
|
||||||
@icon('lock')You don't have the required permissions to select this item.
|
@icon('lock'){{ trans('entities.entity_select_lack_permission') }}
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
|
|
@ -38,13 +38,6 @@ use Illuminate\View\Middleware\ShareErrorsFromSession;
|
||||||
Route::get('/status', [StatusController::class, 'show']);
|
Route::get('/status', [StatusController::class, 'show']);
|
||||||
Route::get('/robots.txt', [HomeController::class, 'robots']);
|
Route::get('/robots.txt', [HomeController::class, 'robots']);
|
||||||
|
|
||||||
Route::get('/test', function() {
|
|
||||||
$book = \BookStack\Entities\Models\Book::query()->where('slug', '=', 'k5TrhXxaNb')->firstOrFail();
|
|
||||||
$builder= app()->make(\BookStack\Auth\Permissions\JointPermissionBuilder::class);
|
|
||||||
$builder->rebuildForEntity($book);
|
|
||||||
return 'finished';
|
|
||||||
})->withoutMiddleware('web');
|
|
||||||
|
|
||||||
// Authenticated routes...
|
// Authenticated routes...
|
||||||
Route::middleware('auth')->group(function () {
|
Route::middleware('auth')->group(function () {
|
||||||
|
|
||||||
|
|
|
@ -214,7 +214,7 @@ class EntitySearchTest extends TestCase
|
||||||
$defaultListTest->assertDontSee($notVisitedPage->name);
|
$defaultListTest->assertDontSee($notVisitedPage->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_ajax_entity_serach_shows_breadcrumbs()
|
public function test_ajax_entity_search_shows_breadcrumbs()
|
||||||
{
|
{
|
||||||
$chapter = Chapter::first();
|
$chapter = Chapter::first();
|
||||||
$page = $chapter->pages->first();
|
$page = $chapter->pages->first();
|
||||||
|
@ -230,6 +230,21 @@ class EntitySearchTest extends TestCase
|
||||||
$chapterSearch->assertSee($chapter->book->getShortName(42));
|
$chapterSearch->assertSee($chapter->book->getShortName(42));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_ajax_entity_search_reflects_items_without_permission()
|
||||||
|
{
|
||||||
|
$page = Page::query()->first();
|
||||||
|
$baseSelector = 'a[data-entity-type="page"][data-entity-id="' . $page->id . '"]';
|
||||||
|
$searchUrl = "/ajax/search/entities?permission=update&term=" . urlencode($page->name);
|
||||||
|
|
||||||
|
$resp = $this->asEditor()->get($searchUrl);
|
||||||
|
$resp->assertElementContains($baseSelector, $page->name);
|
||||||
|
$resp->assertElementNotContains($baseSelector, "You don't have the required permissions to select this item");
|
||||||
|
|
||||||
|
$resp = $this->actingAs($this->getViewer())->get($searchUrl);
|
||||||
|
$resp->assertElementContains($baseSelector, $page->name);
|
||||||
|
$resp->assertElementContains($baseSelector, "You don't have the required permissions to select this item");
|
||||||
|
}
|
||||||
|
|
||||||
public function test_sibling_search_for_pages()
|
public function test_sibling_search_for_pages()
|
||||||
{
|
{
|
||||||
$chapter = Chapter::query()->with('pages')->first();
|
$chapter = Chapter::query()->with('pages')->first();
|
||||||
|
|
Loading…
Reference in a new issue