Let the presenter resume a paused poll with the pause button
CI / Deploy / test (push) Successful in 1m0s
CI / Deploy / deploy (push) Skipped

The pause button was hidden while paused, so only the arrow keys could
continue. It now toggles between pause and resume (also via P), using an
explicit idempotent `resume` control action so double clicks never
pause again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
gnilebeinandClaude Opus 5.5 committed 2026-11-09 10:51:13 +01:00
1 parent 6912d045cf
commit 430a18865d
5 files changed
+52 -9

No files matched your search

@@ -289,6 +289,34 @@ class AdminControllerTest extends TestCase
$this->assertSame($second->id, $this->pollsTable()->get($poll->id)->current_slide_id, 'stays on last slide');
}
public function testPauseAndResumeAreIdempotent(): void
{
[$poll, $token] = $this->createPoll();
$this->createSlide($poll, Slide::TYPE_CHOICE);
$second = $this->createSlide($poll, Slide::TYPE_WORDCLOUD);
$this->get("/admin/$token/present");
$this->configRequest(['headers' => ['Accept' => 'application/json']]);
$this->post("/admin/$token/control", ['action' => 'goto', 'slide_id' => $second->id]);
foreach ([1, 2] as $attempt) {
$this->configRequest(['headers' => ['Accept' => 'application/json']]);
$this->post("/admin/$token/control", ['action' => 'stop']);
$this->assertResponseOk();
$state = json_decode((string)$this->_response->getBody(), true);
$this->assertNull($state['slide'], "paused after stop #$attempt");
$this->assertTrue($state['poll']['isPaused']);
}
foreach ([1, 2] as $attempt) {
$this->configRequest(['headers' => ['Accept' => 'application/json']]);
$this->post("/admin/$token/control", ['action' => 'resume']);
$this->assertResponseOk();
$state = json_decode((string)$this->_response->getBody(), true);
$this->assertSame($second->id, $state['slide']['id'], "resumes the paused slide (#$attempt)");
$this->assertFalse($state['poll']['isPaused']);
}
}
public function testControlRejectsSlideOfOtherPoll(): void
{
[, $token] = $this->createPoll('A');