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

Pages: Updated editor field to always be set

- Migration for setting on existing pages
- Added test to cover simple new page scenario

For #5117
This commit is contained in:
Dan Brown
2024-09-29 14:36:41 +01:00
parent 6103a22feb
commit 89f84c9a95
3 changed files with 67 additions and 2 deletions

View File

@ -24,6 +24,21 @@ class PageEditorTest extends TestCase
$this->withHtml($this->followRedirects($resp))->assertElementExists('#html-editor');
}
public function test_editor_set_for_new_pages()
{
$book = $this->page->book;
$this->asEditor()->get($book->getUrl('/create-page'));
$newPage = $book->pages()->orderBy('id', 'desc')->first();
$this->assertEquals('wysiwyg', $newPage->editor);
$this->setSettings(['app-editor' => PageEditorType::Markdown->value]);
$this->asEditor()->get($book->getUrl('/create-page'));
$newPage = $book->pages()->orderBy('id', 'desc')->first();
$this->assertEquals('markdown', $newPage->editor);
}
public function test_markdown_setting_shows_markdown_editor_for_new_pages()
{
$this->setSettings(['app-editor' => PageEditorType::Markdown->value]);