Verlinke interne Seiten und Sprungmarken auch im formatierten Text der Website
Neues Werkzeug neben dem freien Link in Fließtext, Überschrift-Einleitung und Bild-Text. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6172364bf8
commit
6b43fbb7d1
5 files changed
+186
-2
No files matched your search
@@ -2,10 +2,14 @@
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Domain\Catalog\FormattedText;
|
||||
use App\Domain\Cms\LinkTargets;
|
||||
use App\Domain\Cms\Page;
|
||||
use App\Domain\Cms\PageService;
|
||||
use App\Domain\Cms\Widgets\Support\RichText;
|
||||
use App\Domain\Cms\Widgets\Types\ImageTextWidget;
|
||||
use App\Filament\Resources\Pages\Pages\EditPage;
|
||||
use App\Filament\Support\RichField;
|
||||
use App\Models\User;
|
||||
use Filament\Facades\Filament;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
@@ -207,4 +211,22 @@ public function test_widgets_link_to_a_section_of_the_same_page_and_to_another_p
|
||||
$this->assertStringContainsString('id="oben"', $html);
|
||||
$this->get('/ziel')->assertOk()->assertSee('id="unten"', false);
|
||||
}
|
||||
|
||||
public function test_links_to_anchors_survive_the_text_sanitizers(): void
|
||||
{
|
||||
$html = '<p><a href="#kurse">hier</a> und <a href="/ziel#unten">dort</a></p>';
|
||||
|
||||
foreach ([RichText::sanitize($html), FormattedText::canonical($html, site: true)] as $clean) {
|
||||
$this->assertStringContainsString('href="#kurse"', $clean);
|
||||
$this->assertStringContainsString('href="/ziel#unten"', $clean);
|
||||
}
|
||||
}
|
||||
|
||||
public function test_website_text_editors_offer_the_internal_link_tool(): void
|
||||
{
|
||||
foreach ([RichField::make('body', 'Text', website: true), (new ImageTextWidget)->dataFields()[2]] as $editor) {
|
||||
$buttons = (new \ReflectionProperty($editor, 'toolbarButtons'))->getValue($editor);
|
||||
$this->assertContains('interneSeite', array_merge(...$buttons), 'Das Werkzeug fehlt in der Symbolleiste.');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user