X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/c7a2d568bf693add30c8402d68d1f46f09a44c5b..refs/pull/2700/head:/tests/Entity/PageContentTest.php diff --git a/tests/Entity/PageContentTest.php b/tests/Entity/PageContentTest.php index 6a7b58ffb..6d5200794 100644 --- a/tests/Entity/PageContentTest.php +++ b/tests/Entity/PageContentTest.php @@ -1,7 +1,7 @@ refresh(); $this->assertEquals('"Hello & welcome"', $page->text); } + + public function test_page_markdown_table_rendering() + { + $this->asEditor(); + $page = Page::query()->first(); + + $content = '| Syntax | Description | +| ----------- | ----------- | +| Header | Title | +| Paragraph | Text |'; + $this->put($page->getUrl(), [ + 'name' => $page->name, 'markdown' => $content, + 'html' => '', 'summary' => '' + ]); + + $page->refresh(); + $this->assertStringContainsString('', $page->html); + + $pageView = $this->get($page->getUrl()); + $pageView->assertElementExists('.page-content table tbody td'); + } + + public function test_page_markdown_task_list_rendering() + { + $this->asEditor(); + $page = Page::query()->first(); + + $content = '- [ ] Item a +- [x] Item b'; + $this->put($page->getUrl(), [ + 'name' => $page->name, 'markdown' => $content, + 'html' => '', 'summary' => '' + ]); + + $page->refresh(); + $this->assertStringContainsString('input', $page->html); + $this->assertStringContainsString('type="checkbox"', $page->html); + + $pageView = $this->get($page->getUrl()); + $pageView->assertElementExists('.page-content input[type=checkbox]'); + } + + public function test_page_markdown_strikethrough_rendering() + { + $this->asEditor(); + $page = Page::query()->first(); + + $content = '~~some crossed out text~~'; + $this->put($page->getUrl(), [ + 'name' => $page->name, 'markdown' => $content, + 'html' => '', 'summary' => '' + ]); + + $page->refresh(); + $this->assertStringMatchesFormat('%Asome crossed out text%A', $page->html); + + $pageView = $this->get($page->getUrl()); + $pageView->assertElementExists('.page-content p > s'); + } }