namespace Tests\User;
-use BookStack\Entities\Models\Bookshelf;
use Tests\TestCase;
class UserPreferencesTest extends TestCase
public function test_shelf_view_type_change()
{
$editor = $this->getEditor();
- /** @var Bookshelf $shelf */
- $shelf = Bookshelf::query()->first();
+ $shelf = $this->entities->shelf();
setting()->putUser($editor, 'bookshelf_view_type', 'list');
$resp = $this->actingAs($editor)->get($shelf->getUrl())->assertSee('Grid View');
->assertElementExists('.featured-image-container')
->assertElementNotExists('.content-wrap .entity-list-item');
}
+
+ public function test_update_code_language_favourite()
+ {
+ $editor = $this->getEditor();
+ $page = $this->entities->page();
+ $this->actingAs($editor);
+
+ $this->patch('/settings/users/update-code-language-favourite', ['language' => 'php', 'active' => true]);
+ $this->patch('/settings/users/update-code-language-favourite', ['language' => 'javascript', 'active' => true]);
+
+ $resp = $this->get($page->getUrl('/edit'));
+ $resp->assertSee('option:code-editor:favourites="php,javascript"', false);
+
+ $this->patch('/settings/users/update-code-language-favourite', ['language' => 'ruby', 'active' => true]);
+ $this->patch('/settings/users/update-code-language-favourite', ['language' => 'php', 'active' => false]);
+
+ $resp = $this->get($page->getUrl('/edit'));
+ $resp->assertSee('option:code-editor:favourites="javascript,ruby"', false);
+ }
}