Merge phase/40-clock-tempo.
This commit is contained in:
@@ -327,6 +327,6 @@ describe('decodeServerMessage', () => {
|
||||
|
||||
describe('clock speeds', () => {
|
||||
it('matches the server table', () => {
|
||||
expect([...CLOCK_SPEEDS]).toEqual([0.5, 1, 2, 3, 4]);
|
||||
expect([...CLOCK_SPEEDS]).toEqual([0.5, 1, 2, 5, 10]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -33,7 +33,7 @@ export const WireLocale = {
|
||||
* Speed buttons, in wire order — the index travels, not the multiplier.
|
||||
* Mirror of `ClockSpeed.Multipliers` in `src/HSchool.Simulation/ClockSpeed.cs`.
|
||||
*/
|
||||
export const CLOCK_SPEEDS = [0.5, 1, 2, 3, 4] as const;
|
||||
export const CLOCK_SPEEDS = [0.5, 1, 2, 5, 10] as const;
|
||||
|
||||
export const DEFAULT_SPEED_INDEX = 1;
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* @vitest-environment happy-dom
|
||||
*/
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import { GameScreen } from './gameScreen.ts';
|
||||
|
||||
describe('GameScreen speed buttons', () => {
|
||||
it('shows five speed buttons ×½ ×1 ×2 ×5 ×10', () => {
|
||||
const onSetSpeed = vi.fn();
|
||||
const screen = new GameScreen({
|
||||
onLeave: () => {},
|
||||
onSetRunning: () => {},
|
||||
onSetSpeed,
|
||||
onSkip: () => {},
|
||||
});
|
||||
|
||||
document.body.append(screen.element);
|
||||
|
||||
const labels = [...screen.element.querySelectorAll('.clock__controls .button--small')]
|
||||
.map((button) => button.textContent ?? '')
|
||||
.filter((text) => text.startsWith('×'));
|
||||
|
||||
expect(labels).toEqual(['×½', '×1', '×2', '×5', '×10']);
|
||||
});
|
||||
});
|
||||
@@ -24,7 +24,7 @@ interface GameScreenOptions {
|
||||
readonly onSkip: () => void;
|
||||
}
|
||||
|
||||
const SPEED_LABELS = ['×½', '×1', '×2', '×3', '×4'];
|
||||
const SPEED_LABELS = ['×½', '×1', '×2', '×5', '×10'];
|
||||
|
||||
/**
|
||||
* The inside of a school: calendar controls plus the manager shell. The tree comes from one map
|
||||
|
||||
@@ -23,7 +23,7 @@ interface MainMenuOptions {
|
||||
* timer — the server is the only thing that knows what time it is in each of them.
|
||||
*
|
||||
* One second is well below the resolution the cards show: at ×1 a game minute passes every
|
||||
* 12 real seconds, at ×4 every 3.
|
||||
* real second, at ×10 every tenth of a second on the clock (still one poll per second here).
|
||||
*/
|
||||
const REFRESH_INTERVAL_MS = 1000;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user