feat: break timer — pause the session clock so breaks don't poison drift
Add <break-timer> tray: pick a duration, Start break pauses the session clock (reusing clock.pause/resume), End break resumes it — so meal/comfort break time is excluded from elapsed and drift stays honest. The shell owns pause/resume + persistence (break store key); the rail shows a on-break badge and gains a coffee chip. fmtCountdown (M:SS) added to format.js. tests/components/break-timer.test.js + gm-shell-break.test.js (incl. the 30-play/20-break/10-play drift-honesty case) + fmtCountdown. 159 tests pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
49e9dcda46
commit
73a7ea72ad
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { fmtElapsed, fmtDrift } from '../../src/core/format.js';
|
||||
import { fmtElapsed, fmtDrift, fmtCountdown } from '../../src/core/format.js';
|
||||
|
||||
describe('formatting', () => {
|
||||
it('formats elapsed time', () => {
|
||||
@@ -13,4 +13,10 @@ describe('formatting', () => {
|
||||
expect(fmtDrift(6)).toBe('+6 behind');
|
||||
expect(fmtDrift(-3)).toBe('3 ahead');
|
||||
});
|
||||
it('formats a countdown as M:SS', () => {
|
||||
expect(fmtCountdown(0)).toBe('0:00');
|
||||
expect(fmtCountdown(9 * 60000 + 47 * 1000)).toBe('9:47');
|
||||
expect(fmtCountdown(10 * 60000)).toBe('10:00');
|
||||
expect(fmtCountdown(-5000)).toBe('0:00'); // clamps negatives
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user