mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-04 23:18:01 +00:00
2f7909ccc3
Adds custom, persisted names for the three aux timers, editable in the editor settings and surfaced everywhere an aux title is shown. - Persist `auxTimerNames` on the Settings object (default empty, falls back to the stock "Aux N" label when unset). Reuses the existing settings pipeline: validation sanitises to a fixed-length trimmed array, the parser normalises loaded/legacy data, and migrations carry the field forward. - New "Aux timers" settings section to name each timer, plus a shortcut button next to the aux timers in the playback control that jumps straight to it. - Resolve names via a shared getAuxTimerLabel helper in the aux timer control, Studio view, secondary-source selector and preview, and the automation action labels. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WCZejVTzuAY3tHTE6nB3JH
37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
import { Settings } from 'ontime-types';
|
|
|
|
import { parseSettings } from '../settings.parser.js';
|
|
|
|
describe('parseSettings()', () => {
|
|
it('throws if settings object does not exist', () => {
|
|
expect(() => parseSettings({})).toThrow('ERROR: unable to parse settings, missing or incorrect version');
|
|
});
|
|
|
|
it('returns an a base model as long as we have the app version', () => {
|
|
const result = parseSettings({ settings: { version: '1' } as Settings });
|
|
expect(result).toBeTypeOf('object');
|
|
expect(result).toMatchObject({
|
|
version: expect.any(String),
|
|
editorKey: null,
|
|
operatorKey: null,
|
|
timeFormat: '24',
|
|
language: 'en',
|
|
auxTimerNames: ['', '', ''],
|
|
});
|
|
});
|
|
|
|
it('carries custom aux timer names through and normalises to a length-3 array', () => {
|
|
const result = parseSettings({
|
|
settings: { version: '1', auxTimerNames: ['Speaker'] } as unknown as Settings,
|
|
});
|
|
expect(result.auxTimerNames).toStrictEqual(['Speaker', '', '']);
|
|
});
|
|
|
|
it('falls back to defaults when aux timer names are missing or malformed', () => {
|
|
const result = parseSettings({
|
|
settings: { version: '1', auxTimerNames: 'not-an-array' } as unknown as Settings,
|
|
});
|
|
expect(result.auxTimerNames).toStrictEqual(['', '', '']);
|
|
});
|
|
});
|