public function test_page_includes()
{
- $page = Page::first();
- $secondPage = Page::where('id', '!=', $page->id)->first();
+ $page = Page::query()->first();
+ $secondPage = Page::query()->where('id', '!=', $page->id)->first();
$secondPage->html = "<p id='section1'>Hello, This is a test</p><p id='section2'>This is a second block of content</p>";
$secondPage->save();
public function test_saving_page_with_includes()
{
- $page = Page::first();
- $secondPage = Page::where('id', '!=', $page->id)->first();
+ $page = Page::query()->first();
+ $secondPage = Page::query()->where('id', '!=', $page->id)->first();
$this->asEditor();
$includeTag = '{{@' . $secondPage->id . '}}';
public function test_page_includes_do_not_break_tables()
{
- $page = Page::first();
- $secondPage = Page::where('id', '!=', $page->id)->first();
+ $page = Page::query()->first();
+ $secondPage = Page::query()->where('id', '!=', $page->id)->first();
$content = '<table id="table"><tbody><tr><td>test</td></tr></tbody></table>';
$secondPage->html = $content;
public function test_page_content_scripts_removed_by_default()
{
$this->asEditor();
- $page = Page::first();
+ $page = Page::query()->first();
$script = 'abc123<script>console.log("hello-test")</script>abc123';
$page->html = "escape {$script}";
$page->save();
];
$this->asEditor();
- $page = Page::first();
+ $page = Page::query()->first();
foreach ($checks as $check) {
$page->html = $check;
];
$this->asEditor();
- $page = Page::first();
+ $page = Page::query()->first();
foreach ($checks as $check) {
$page->html = $check;
];
$this->asEditor();
- $page = Page::first();
+ $page = Page::query()->first();
foreach ($checks as $check) {
$page->html = $check;
];
$this->asEditor();
- $page = Page::first();
+ $page = Page::query()->first();
foreach ($checks as $check) {
$page->html = $check;
];
$this->asEditor();
- $page = Page::first();
+ $page = Page::query()->first();
foreach ($checks as $check) {
$page->html = $check;
public function test_page_inline_on_attributes_removed_by_default()
{
$this->asEditor();
- $page = Page::first();
+ $page = Page::query()->first();
$script = '<p onmouseenter="console.log(\'test\')">Hello</p>';
$page->html = "escape {$script}";
$page->save();
];
$this->asEditor();
- $page = Page::first();
+ $page = Page::query()->first();
foreach ($checks as $check) {
$page->html = $check;
public function test_page_content_scripts_show_when_configured()
{
$this->asEditor();
- $page = Page::first();
+ $page = Page::query()->first();
config()->push('app.allow_content_scripts', 'true');
$script = 'abc123<script>console.log("hello-test")</script>abc123';
public function test_page_inline_on_attributes_show_if_configured()
{
$this->asEditor();
- $page = Page::first();
+ $page = Page::query()->first();
config()->push('app.allow_content_scripts', 'true');
$script = '<p onmouseenter="console.log(\'test\')">Hello</p>';
public function test_duplicate_ids_does_not_break_page_render()
{
$this->asEditor();
- $pageA = Page::first();
+ $pageA = Page::query()->first();
$pageB = Page::query()->where('id', '!=', $pageA->id)->first();
$content = '<ul id="bkmrk-xxx-%28"></ul> <ul id="bkmrk-xxx-%28"></ul>';
public function test_duplicate_ids_fixed_on_page_save()
{
$this->asEditor();
- $page = Page::first();
+ $page = Page::query()->first();
$content = '<ul id="bkmrk-test"><li>test a</li><li><ul id="bkmrk-test"><li>test b</li></ul></li></ul>';
$pageSave = $this->put($page->getUrl(), [
]);
$pageSave->assertRedirect();
- $updatedPage = Page::where('id', '=', $page->id)->first();
+ $updatedPage = Page::query()->where('id', '=', $page->id)->first();
$this->assertEquals(substr_count($updatedPage->html, "bkmrk-test\""), 1);
}
public function test_anchors_referencing_non_bkmrk_ids_rewritten_after_save()
{
$this->asEditor();
- $page = Page::first();
+ $page = Page::query()->first();
$content = '<h1 id="non-standard-id">test</h1><p><a href="#non-standard-id">link</a></p>';
$this->put($page->getUrl(), [
'summary' => ''
]);
- $updatedPage = Page::where('id', '=', $page->id)->first();
+ $updatedPage = Page::query()->where('id', '=', $page->id)->first();
$this->assertStringContainsString('id="bkmrk-test"', $updatedPage->html);
$this->assertStringContainsString('href="#bkmrk-test"', $updatedPage->html);
}
$pageView->assertElementExists('.page-content p > s');
}
+ public function test_page_markdown_single_html_comment_saving()
+ {
+ $this->asEditor();
+ $page = Page::query()->first();
+
+ $content = '<!-- Test Comment -->';
+ $this->put($page->getUrl(), [
+ 'name' => $page->name, 'markdown' => $content,
+ 'html' => '', 'summary' => ''
+ ]);
+
+ $page->refresh();
+ $this->assertStringMatchesFormat($content, $page->html);
+
+ $pageView = $this->get($page->getUrl());
+ $pageView->assertStatus(200);
+ $pageView->assertSee($content);
+ }
+
public function test_base64_images_get_extracted_from_page_content()
{
$this->asEditor();