T1: catalog test knows theme settings, notification keys follow the convention
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
086bc8a925
commit
d81c943905
4 changed files with 18 additions and 5 deletions
|
|
@ -85,10 +85,18 @@ function camel(value: string): string {
|
|||
* - Rust `*_key: "…"` fields: theme labels and the settings' `labelKey`
|
||||
* and `descriptionKey`;
|
||||
* - per settings definition, its section name (`settings.section.<s>`) and
|
||||
* each enum value (`settings.<key>.value.<value>`).
|
||||
* each enum value (`settings.<key>.value.<value>`); a `Kind::Theme`
|
||||
* setting has every built-in theme id of `theme.rs` and `system` as
|
||||
* values (C9 T1).
|
||||
*/
|
||||
const RUNTIME_KEYS = (() => {
|
||||
const keys = new Set<string>();
|
||||
const themeIds = [
|
||||
...[...shippedRust(join(REPO, "crates", "engine", "src", "theme.rs")).matchAll(/\bid:\s*"([a-z0-9-]+)"/g)].map(
|
||||
(m) => m[1] ?? "",
|
||||
),
|
||||
"system",
|
||||
];
|
||||
const add = (text: string, pattern: RegExp): void => {
|
||||
for (const m of text.matchAll(pattern)) {
|
||||
keys.add(m[1] ?? "");
|
||||
|
|
@ -112,6 +120,11 @@ const RUNTIME_KEYS = (() => {
|
|||
for (const value of values.matchAll(/"([^"]+)"/g)) {
|
||||
keys.add(`settings.${key ?? ""}.value.${camel(value[1] ?? "")}`);
|
||||
}
|
||||
if (/Kind::Theme\b/.test(body)) {
|
||||
for (const id of themeIds) {
|
||||
keys.add(`settings.${key ?? ""}.value.${camel(id)}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
keys.delete("");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue