Make the slide image description optional
CI / Deploy / PHP 8.4 (push) Successful in 1m12s
CI / Deploy / PHP 8.5 (push) Successful in 1m13s
CI / Deploy / test (push) Successful in 1s
CI / Deploy / deploy (push) Skipped

A missing description rejected the whole save and dropped the selected
file, which cannot be refilled in the form. The description is now an
optional hint for screen readers; empty means alt="". The "decorative"
checkbox is gone, it meant the same.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
gnilebeinandClaude Sonnet 5.5 committed 2026-11-15 13:56:27 +01:00
1 parent 8522918c75
commit 33c75e504f
4 files changed
+13 -38

No files matched your search

+5 -13
View File
@@ -77,27 +77,19 @@ class SlideImageTest extends TestCase
$this->assertSame(Slide::IMAGE_TOP, $choice->imageLayout(), 'full exists for content slides only');
}
public function testImageNeedsAltTextOrDecorativeFlag(): void
public function testImageDescriptionIsOptional(): void
{
[$poll, $token] = $this->createPoll();
$this->postWithImage("/admin/$token/slides/add?type=content", [
'type' => 'content',
'question' => 'Ohne Text',
'question' => 'Ohne Beschreibung',
], $this->makeImage());
$this->assertResponseOk();
$this->assertResponseContains('Bitte beschreibe das Bild');
$this->assertSame(0, $this->slidesTable()->find()->where(['poll_id' => $poll->id])->count());
$this->assertSame([], $this->storedImages($poll->id), 'no file left behind');
$this->postWithImage("/admin/$token/slides/add?type=content", [
'type' => 'content',
'question' => 'Dekoration',
'image_decorative' => '1',
], $this->makeImage());
$this->assertRedirect(['_name' => 'admin', 'token' => $token]);
$slide = $this->slidesTable()->find()->where(['poll_id' => $poll->id])->firstOrFail();
$this->assertSame('', $slide->image_alt);
$this->assertTrue($slide->hasImage());
$this->assertSame('', $slide->image_alt);
$this->assertSame([$slide->image], $this->storedImages($poll->id));
}
public function testRejectsFilesThatAreNoImages(): void