Add the editor: toolbar, photos in the text, a server preview and a focus point
This commit is contained in:
1 parent
6b41bfddd3
commit
6a51b0e649
18 files changed
+224
-17
No files matched your search
@@ -47,7 +47,7 @@ describe('what is switched on', function () {
|
||||
->filter(fn ($name) => is_string($name) && str_starts_with($name, 'manager.'))
|
||||
->map(fn ($name) => substr($name, 8))
|
||||
// The login and the built files are outside `auth` (nobody is known there); a logout is logged by Laravel's Logout event.
|
||||
->reject(fn ($name) => $name === '' || in_array($name, [...$labelled, 'assets', 'login', 'login.store', 'logout'], true))
|
||||
->reject(fn ($name) => $name === '' || in_array($name, [...$labelled, 'assets', 'login', 'login.store', 'logout', 'markdown.preview'], true))
|
||||
->values()->all();
|
||||
|
||||
expect($missing)->toBe([]);
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
use IriksIT\Manager\Models\AuditLog;
|
||||
use IriksIT\Manager\Tests\AuditOnTestCase;
|
||||
|
||||
uses(AuditOnTestCase::class);
|
||||
|
||||
it('renders the preview the way the site does, with raw HTML escaped', function () {
|
||||
$this->actingAs(makeUser(['posts.view']));
|
||||
|
||||
$html = $this->postJson('/manager/markdown', ['text' => "## Hi\n\n**bold** \n\n<script>alert(1)</script>"])->assertOk()->json('html');
|
||||
|
||||
expect($html)->toContain('<h2>Hi</h2>', '<strong>bold</strong>', '<img src="/media/a.jpg" alt="alt"')
|
||||
->and($html)->not->toContain('<script>');
|
||||
});
|
||||
|
||||
it('answers only to those who are logged in, and is not written in the audit log', function () {
|
||||
$this->postJson('/manager/markdown', ['text' => 'x'])->assertUnauthorized();
|
||||
|
||||
$this->actingAs(makeUser(['posts.view']));
|
||||
$this->postJson('/manager/markdown', ['text' => 'x'])->assertOk();
|
||||
$this->postJson('/manager/markdown', ['text' => str_repeat('a', 200001)])->assertJsonValidationErrors(['text']);
|
||||
|
||||
expect(AuditLog::query()->where('action', 'markdown.preview')->count())->toBe(0);
|
||||
});
|
||||
Reference in new issue
Block a user