[ui] CalmRefresh: One quiet line and Refresh when a new version of the garden is waiting
This commit is contained in:
@@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user