[ui] CalmRefresh: One quiet line and Refresh when a new version of the garden is waiting

This commit is contained in:
2026-11-02 01:18:08 +01:00
parent 8c84cbbb52
commit beea8eaa10
3 changed files with 73 additions and 1 deletions
+24
View File
@@ -83,3 +83,27 @@ describe('Shell and the Letter', () => {
expect(screen.getByText(/or not\./)).toBeTruthy();
});
});
describe('Shell and a new version waiting (calm-refresh.md)', () => {
it('says nothing while no new version waits', () => {
render(Shell, { onrefresh: () => undefined });
expect(screen.queryByText(en.update.ready)).toBeNull();
expect(screen.queryByRole('button', { name: en.update.refresh })).toBeNull();
});
it('when one waits: one quiet line and Refresh, which only the player\'s tap sends', async () => {
let refreshed = 0;
render(Shell, { updateReady: true, onrefresh: () => (refreshed += 1) });
expect(screen.getByRole('status').textContent).toBe(en.update.ready);
expect(refreshed).toBe(0);
await fireEvent.click(screen.getByRole('button', { name: en.update.refresh }));
expect(refreshed).toBe(1);
});
it('is there on the Letter too', () => {
window.location.hash = '#letter';
render(Shell, { letter: LETTER, updateReady: true, onrefresh: () => undefined });
expect(h1().textContent).toBe(en.letter.title);
expect(screen.getByRole('button', { name: en.update.refresh })).toBeTruthy();
});
});