Merge pull request 'Pause instead of dangling when the live slide is deleted' (#32) from fix/slide-delete-pause into main
CI / Deploy / test (push) Successful in 55s
CI / Deploy / deploy (push) Successful in 5s

Reviewed-on: #32
This commit was merged in pull request #32.
This commit is contained in:
gnilebein committed 2026-11-08 22:31:45 +01:00
commit 5dcdfdb475
4 files changed
+75 -7

No files matched your search

@@ -182,6 +182,44 @@ class AdminControllerTest extends TestCase
$this->assertSame(2, $this->slidesTable()->get($third->id)->position);
}
public function testDeletingTheLiveSlidePausesAndResumesWithTheNextOne(): void
{
[$poll, $token] = $this->createPoll();
$first = $this->createSlide($poll, Slide::TYPE_OPEN);
$second = $this->createSlide($poll, Slide::TYPE_SCALE);
$third = $this->createSlide($poll, Slide::TYPE_CHOICE);
$poll = $this->goLive($poll, $second);
$this->post("/admin/$token/slides/{$second->id}/delete");
$poll = $this->pollsTable()->get($poll->id);
$this->assertTrue($poll->isPaused(), 'Participants see the pause page.');
$this->assertSame($third->id, $poll->paused_slide_id);
// The paused slide is deleted as well: resume with the previous one (last slide).
$this->post("/admin/$token/slides/{$third->id}/delete");
$poll = $this->pollsTable()->get($poll->id);
$this->assertTrue($poll->isPaused());
$this->assertSame($first->id, $poll->paused_slide_id);
// No slides left: back to "not started".
$this->post("/admin/$token/slides/{$first->id}/delete");
$poll = $this->pollsTable()->get($poll->id);
$this->assertNull($poll->current_slide_id);
$this->assertNull($poll->paused_slide_id);
$this->assertFalse($poll->isPaused());
}
public function testDeletingAnotherSlideKeepsTheLiveOne(): void
{
[$poll, $token] = $this->createPoll();
$live = $this->createSlide($poll, Slide::TYPE_OPEN);
$other = $this->createSlide($poll, Slide::TYPE_SCALE);
$poll = $this->goLive($poll, $live);
$this->post("/admin/$token/slides/{$other->id}/delete");
$this->assertSame($live->id, $this->pollsTable()->get($poll->id)->current_slide_id);
}
public function testReorderSlidesByDragAndDrop(): void
{
[$poll, $token] = $this->createPoll();