Every play button for what is playing shows pause, and pauses it
Only the player bar's button changed; the files pane's, the row's and the toolbar's kept showing play while it played. play() now pauses when asked to play what is already playing, which makes each of them a toggle, and syncPlayButtons() repaints them on play, pause and ended and whenever the list or reader is drawn. Closes #34. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -182,6 +182,27 @@ test('the three panes are there and the item text lands in the bottom one', asyn
|
||||
await expect(page.locator('#files [data-a="play"]')).toHaveCount(0);
|
||||
});
|
||||
|
||||
test('while an episode plays, its play buttons all say pause, and pause it', async ({ page }) => {
|
||||
await page.locator('.feed', { hasText: 'Test Show' }).click();
|
||||
await page.locator('.tabs button', { hasText: 'All' }).first().click();
|
||||
const downloaded = page.locator('.ep', { has: page.locator('.kind.here') }).first();
|
||||
await expect(downloaded).toBeVisible({ timeout: 20_000 });
|
||||
await downloaded.click();
|
||||
await page.evaluate(() => { audio.muted = true; });
|
||||
const pane = page.locator('#files [data-a="play"]');
|
||||
await pane.click();
|
||||
await expect.poll(() => page.evaluate(() => !audio.paused)).toBe(true);
|
||||
// The files pane, the row and the toolbar all follow the player bar, not only the bar.
|
||||
await expect(pane).toHaveAttribute('title', 'Pause');
|
||||
await expect(downloaded.locator('[data-a="play"]')).toHaveAttribute('title', 'Pause');
|
||||
await expect(page.locator('#tbPlay')).toHaveAttribute('title', 'Pause');
|
||||
await pane.click(); // and pressing it pauses
|
||||
await expect.poll(() => page.evaluate(() => audio.paused)).toBe(true);
|
||||
await expect(pane).toHaveAttribute('title', 'Play');
|
||||
await expect(page.locator('#tbPlay')).toHaveAttribute('title', 'Play the selected item');
|
||||
await page.locator('#pclose').click();
|
||||
});
|
||||
|
||||
test('a downloaded file that is not audio gets no player', async ({ page }) => {
|
||||
// Regression: anything with a file got an <audio> element and a play button, so a blog's
|
||||
// header image rendered as a broken player.
|
||||
|
||||
Reference in New Issue
Block a user