Make every image of a zoomable gallery zoomable unless it chose otherwise
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e47f278a13
commit
24f98633d0
4 files changed
+49
-4
No files matched your search
@@ -1154,6 +1154,36 @@ final class CmsTest extends TestCase
|
||||
self::assertStringContainsString("script-src 'none'", (string) $zweite->headers->get('Content-Security-Policy'));
|
||||
}
|
||||
|
||||
public function testAZoomableGalleryMakesEveryImageWithoutItsOwnChoiceZoomable(): void
|
||||
{
|
||||
// Umut: „Bei Galerie muss man da alles einzeln machen? kann man das mit einem Klick für
|
||||
// alle Elemente machen?" Der Haken an der Galerie gilt jetzt für jedes Bild darin, das
|
||||
// selbst nichts gewählt hat. Eine eigene Wahl und ein Link gehen vor.
|
||||
$bild = static fn (string $id, array $props): array => ['id' => $id, 'type' => 'image', 'props' => [
|
||||
'src' => '/media/'.str_repeat('a', 32).'/480', 'alt' => 'Motiv '.$id, 'decorative' => false, 'width' => 480, 'height' => 270, ...$props,
|
||||
]];
|
||||
$document = DemoContent::starter('Startseite');
|
||||
$document['schemaVersion'] = 19;
|
||||
$document['blocks'][] = ['id' => 'galerie', 'type' => 'gallery', 'props' => ['lightbox' => true], 'children' => [
|
||||
$bild('frei1', []),
|
||||
$bild('frei2', []),
|
||||
$bild('still', ['click' => 'keine']),
|
||||
$bild('verlinkt', ['click' => 'link', 'href' => '/kontakt']),
|
||||
]];
|
||||
$document['blocks'][] = ['id' => 'ohne', 'type' => 'gallery', 'props' => [], 'children' => [$bild('ruhig', [])]];
|
||||
$this->pages->publish('page-1', $this->pages->saveDraft('page-1', $document, 0), 1);
|
||||
|
||||
$html = $this->request('/')->getContent();
|
||||
self::assertMatchesRegularExpression('#<figure id="frei1"[^>]*>\s*<a class="image-link image-zoom"#', $html);
|
||||
self::assertMatchesRegularExpression('#<figure id="frei2"[^>]*>\s*<a class="image-link image-zoom"#', $html);
|
||||
self::assertMatchesRegularExpression('#<figure id="still"[^>]*><img#', $html);
|
||||
self::assertMatchesRegularExpression('#<figure id="verlinkt"[^>]*>\s*<a class="image-link" href="/kontakt"#', $html);
|
||||
// Eine Galerie ohne Haken bleibt, wie sie war.
|
||||
self::assertMatchesRegularExpression('#<figure id="ruhig"[^>]*><img#', $html);
|
||||
self::assertSame(2, substr_count($html, 'image-zoom'));
|
||||
self::assertStringContainsString('<script src="/assets/lightbox.js?v=', $html);
|
||||
}
|
||||
|
||||
public function testAPdfFromTheLibraryIsALinkTargetAndOpensInTheViewer(): void
|
||||
{
|
||||
// Umut: „PDFs hochladen und als Button verlinken - und ein Inline-PDF-Viewer wie das
|
||||
|
||||
Reference in new issue
Block a user