Make the slide image description optional
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:
1 parent
8522918c75
commit
33c75e504f
4 files changed
+13
-38
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user