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

MD Exports: Added HTML description conversion

Also updated tests to cover checking description use/conversion.
Made during review of #5313
This commit is contained in:
Dan Brown
2024-12-02 11:46:56 +00:00
parent f12946d581
commit 0f9957bc03
2 changed files with 19 additions and 5 deletions

View File

@ -417,23 +417,35 @@ class ExportTest extends TestCase
public function test_chapter_markdown_export()
{
$chapter = $this->entities->chapter();
$chapter->description_html = '<p>My <strong>chapter</strong> description</p>';
$chapter->save();
$page = $chapter->pages()->first();
$resp = $this->asEditor()->get($chapter->getUrl('/export/markdown'));
$resp->assertSee('# ' . $chapter->name);
$resp->assertSee('# ' . $page->name);
$resp->assertSee('My **chapter** description');
}
public function test_book_markdown_export()
{
$book = Book::query()->whereHas('pages')->whereHas('chapters')->first();
$book->description_html = '<p>My <strong>book</strong> description</p>';
$book->save();
$chapter = $book->chapters()->first();
$chapter->description_html = '<p>My <strong>chapter</strong> description</p>';
$chapter->save();
$page = $chapter->pages()->first();
$resp = $this->asEditor()->get($book->getUrl('/export/markdown'));
$resp->assertSee('# ' . $book->name);
$resp->assertSee('# ' . $chapter->name);
$resp->assertSee('# ' . $page->name);
$resp->assertSee('My **book** description');
$resp->assertSee('My **chapter** description');
}
public function test_book_markdown_export_concats_immediate_pages_with_newlines()