X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/2b46b00f293f3f9607150671e0d8c3b2ffa6630c..refs/pull/3333/head:/tests/Entity/ExportTest.php diff --git a/tests/Entity/ExportTest.php b/tests/Entity/ExportTest.php index 445cd24f3..2841175ad 100644 --- a/tests/Entity/ExportTest.php +++ b/tests/Entity/ExportTest.php @@ -268,7 +268,7 @@ class ExportTest extends TestCase foreach ($entities as $entity) { $resp = $this->asEditor()->get($entity->getUrl('/export/html')); $resp->assertDontSee('window.donkey'); - $resp->assertDontSee('script'); + $resp->assertDontSee('assertSee('.my-test-class { color: red; }'); } } @@ -386,6 +386,18 @@ class ExportTest extends TestCase $resp->assertSee("# Dogcat\n\n```JavaScript\nvar a = 'cat';\n```\n\nAnother line", false); } + public function test_page_markdown_export_handles_tasklist_checkboxes() + { + $page = Page::query()->first()->forceFill([ + 'markdown' => '', + 'html' => '', + ]); + $page->save(); + + $resp = $this->asEditor()->get($page->getUrl('/export/markdown')); + $resp->assertSee("- [x] Item A\n- [ ] Item B", false); + } + public function test_chapter_markdown_export() { $chapter = Chapter::query()->first(); @@ -448,4 +460,18 @@ class ExportTest extends TestCase $resp = $this->get($page->getUrl('/export/pdf')); $resp->assertStatus(500); // Bad response indicates wkhtml usage } + + public function test_html_exports_contain_csp_meta_tag() + { + $entities = [ + Page::query()->first(), + Book::query()->first(), + Chapter::query()->first(), + ]; + + foreach ($entities as $entity) { + $resp = $this->asEditor()->get($entity->getUrl('/export/html')); + $resp->assertElementExists('head meta[http-equiv="Content-Security-Policy"][content*="script-src "]'); + } + } }