1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2024-10-30 07:32:39 +01:00

Added additional testing for editor switching permissions

This commit is contained in:
Dan Brown 2022-04-23 23:34:15 +01:00
parent 0c5723d76e
commit b97c150ac8
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9

View File

@ -178,4 +178,29 @@ class PageEditorTest extends TestCase
$resp->assertElementNotExists("a[href*=\"${editLink}\"]");
}
public function test_page_editor_type_switch_does_not_work_without_change_editor_permissions()
{
/** @var Page $page */
$page = Page::query()->first();
$page->html = '<h2>A Header</h2><p>Some <strong>bold</strong> content.</p>';
$page->save();
$resp = $this->asEditor()->get($page->getUrl('/edit?editor=markdown-stable'));
$resp->assertStatus(200);
$resp->assertElementExists('[component="wysiwyg-editor"]');
$resp->assertElementNotExists('[component="markdown-editor"]');
}
public function test_page_save_does_not_change_active_editor_without_change_editor_permissions()
{
/** @var Page $page */
$page = Page::query()->first();
$page->html = '<h2>A Header</h2><p>Some <strong>bold</strong> content.</p>';
$page->editor = 'wysiwyg';
$page->save();
$this->asEditor()->put($page->getUrl(), ['name' => $page->name, 'markdown' => '## Updated content abc']);
$this->assertEquals('wysiwyg', $page->refresh()->editor);
}
}