1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-07 23:03:00 +03:00

Removed browserkit from a couple of classess

Done a little reorganisation while there of misplaced tests.
Moved MarkdownTest to a new PageEditorTest to avoid confusion with
other markdown elements and to align with other page tests.
This commit is contained in:
Dan Brown
2021-09-13 22:54:21 +01:00
parent 8565187138
commit badaf08e55
9 changed files with 220 additions and 221 deletions

View File

@@ -2,6 +2,7 @@
namespace Tests\User;
use BookStack\Entities\Models\Bookshelf;
use Tests\TestCase;
class UserPreferencesTest extends TestCase
@@ -106,4 +107,44 @@ class UserPreferencesTest extends TestCase
$home = $this->get('/login');
$home->assertElementExists('.dark-mode');
}
public function test_books_view_type_preferences_when_list()
{
$editor = $this->getEditor();
setting()->putUser($editor, 'books_view_type', 'list');
$this->actingAs($editor)->get('/books')
->assertElementNotExists('.featured-image-container')
->assertElementExists('.content-wrap .entity-list-item');
}
public function test_books_view_type_preferences_when_grid()
{
$editor = $this->getEditor();
setting()->putUser($editor, 'books_view_type', 'grid');
$this->actingAs($editor)->get('/books')
->assertElementExists('.featured-image-container');
}
public function test_shelf_view_type_change()
{
$editor = $this->getEditor();
/** @var Bookshelf $shelf */
$shelf = Bookshelf::query()->first();
setting()->putUser($editor, 'bookshelf_view_type', 'list');
$this->actingAs($editor)->get($shelf->getUrl())
->assertElementNotExists('.featured-image-container')
->assertElementExists('.content-wrap .entity-list-item')
->assertSee('Grid View');
$req = $this->patch("/settings/users/{$editor->id}/switch-shelf-view", ['view_type' => 'grid']);
$req->assertRedirect($shelf->getUrl());
$this->actingAs($editor)->get($shelf->getUrl())
->assertElementExists('.featured-image-container')
->assertElementNotExists('.content-wrap .entity-list-item')
->assertSee('List View');
}
}