mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-14 19:26:56 -04:00
Keyboard Shortcuts: importMatches.list answers an unknown parameter key with an error
Since #1442 (3acc29f8), a caller outside the app gets an error for a
parameter key that the command's params description doesn't name, and
every_description_parses requires each top-level entry of the params
object to start with a key. The note on query in importMatches.list had
a comma at the top level ("text in the name, target or label"), so the
description didn't parse: the test failed, and the command took any key.
The note is now in parentheses, and the command takes kind and query.
A test checks that shortcutSet.read and the three importMatches
commands take every key they read and refuse a misspelled one.
This commit is contained in:
1 parent
d1108bdbca
commit
8c889279f8
2 files changed
+15
-1
No files matched your search
@@ -45,7 +45,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
"Import Matches",
|
||||
[],
|
||||
None,
|
||||
"{kind?: name|key|modifiers, query?: text in the name, target or label (any case)} the matches the user confirmed when importing other apps' files (shortcut sets), kept with the preferences → [{kind, name, target, label?}] (target \"\": no equivalent)",
|
||||
"{kind?: name|key|modifiers, query?: text (in the name, target or label; any case)} the matches the user confirmed when importing other apps' files (shortcut sets), kept with the preferences → [{kind, name, target, label?}] (target \"\": no equivalent)",
|
||||
always,
|
||||
list
|
||||
),
|
||||
|
||||
@@ -224,3 +224,17 @@ fn read_shows_what_earlier_imports_matched() {
|
||||
let mods = json!([{"value": 0, "count": 1, "mods": ""}, {"value": 64, "count": 1, "mods": "Cmd"}, {"value": 80, "count": 1}]);
|
||||
assert_eq!(r["codes"]["modifiers"], mods);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_commands_take_only_the_keys_they_describe() {
|
||||
// The control channel, MCP and the CLI check params against the description (#1442).
|
||||
for (id, every_key) in [
|
||||
("shortcutSet.read", json!({"path": "/x/a.kys", "data": "", "dataBase64": "", "name": "a.kys"})),
|
||||
("importMatches.list", json!({"kind": "name", "query": "undo"})),
|
||||
("importMatches.set", json!({"matches": []})),
|
||||
("importMatches.reset", json!({"kind": "key"})),
|
||||
] {
|
||||
check_params(id, &every_key).unwrap();
|
||||
assert!(check_params(id, &json!({"qeury": "undo"})).is_err(), "{id}");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user