feat(materials): add campaign materials overlay for sessions
Let GMs manage and show images over the scene from the editor and control panel, with zoom tools, help docs, and full ru/en i18n. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
|
||||
import { inferEditorLocaleFromSystem, normalizeEditorLocale } from './editorMessages';
|
||||
import { HELP_SECTION_IDS, helpSectionBodyKey, helpSectionTitleKey } from '../help/helpSections';
|
||||
|
||||
import { EDITOR_MESSAGES, inferEditorLocaleFromSystem, normalizeEditorLocale } from './editorMessages';
|
||||
|
||||
void test('inferEditorLocaleFromSystem: en-* wins when listed first', () => {
|
||||
assert.equal(inferEditorLocaleFromSystem(['en-GB', 'ru-RU']), 'en');
|
||||
@@ -28,3 +30,31 @@ void test('normalizeEditorLocale: blank or invalid defers to infer (explicit lis
|
||||
assert.equal(normalizeEditorLocale(''), inferEditorLocaleFromSystem([]));
|
||||
assert.equal(normalizeEditorLocale('xx'), inferEditorLocaleFromSystem([]));
|
||||
});
|
||||
|
||||
void test('EDITOR_MESSAGES: ru and en have the same keys', () => {
|
||||
const ruKeys = Object.keys(EDITOR_MESSAGES.ru).sort();
|
||||
const enKeys = Object.keys(EDITOR_MESSAGES.en).sort();
|
||||
assert.deepEqual(enKeys, ruKeys);
|
||||
});
|
||||
|
||||
void test('EDITOR_MESSAGES: every help section has title and body in both locales', () => {
|
||||
for (const id of HELP_SECTION_IDS) {
|
||||
const title = helpSectionTitleKey(id);
|
||||
const body = helpSectionBodyKey(id);
|
||||
for (const locale of ['ru', 'en'] as const) {
|
||||
assert.ok(EDITOR_MESSAGES[locale][title], `missing ${locale} ${title}`);
|
||||
assert.ok(EDITOR_MESSAGES[locale][body], `missing ${locale} ${body}`);
|
||||
assert.notEqual(EDITOR_MESSAGES[locale][title]!.trim(), '');
|
||||
assert.notEqual(EDITOR_MESSAGES[locale][body]!.trim(), '');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
void test('EDITOR_MESSAGES: materials.* keys exist in both locales', () => {
|
||||
const materialKeys = Object.keys(EDITOR_MESSAGES.ru).filter((k) => k.startsWith('materials.'));
|
||||
assert.ok(materialKeys.length >= 20, `expected materials.* keys, got ${String(materialKeys.length)}`);
|
||||
for (const key of materialKeys) {
|
||||
assert.ok(EDITOR_MESSAGES.en[key], `missing en ${key}`);
|
||||
assert.notEqual(EDITOR_MESSAGES.en[key]!.trim(), '');
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user