mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-30 15:15:24 +00:00
feat: add descriptions to plugin host enable toggles
This commit is contained in:
1 parent
c7fd900732
commit
7b1e0294aa
18 files changed
+53
-6
No files matched your search
@@ -175,6 +175,7 @@ export function declaredFields(
|
||||
key: host.enableKey,
|
||||
type: "boolean",
|
||||
labelKey: host.enableLabelKey,
|
||||
descriptionKey: host.enableDescriptionKey,
|
||||
default: host.enableDefault ?? false,
|
||||
},
|
||||
]
|
||||
|
||||
@@ -301,6 +301,21 @@ describe("contributes.settings", () => {
|
||||
expect(errors.join(" ")).toContain("enableLabelKey");
|
||||
});
|
||||
|
||||
it("accepts an enableDescriptionKey and rejects an empty one", () => {
|
||||
const host = { enableKey: "enableThing", enableLabelKey: "k", fields: [] };
|
||||
|
||||
expect(
|
||||
validateManifest(
|
||||
withSettings({ host: { ...host, enableDescriptionKey: "d" } }),
|
||||
),
|
||||
).toEqual([]);
|
||||
expect(
|
||||
validateManifest(
|
||||
withSettings({ host: { ...host, enableDescriptionKey: "" } }),
|
||||
).join(" "),
|
||||
).toContain("enableDescriptionKey");
|
||||
});
|
||||
|
||||
it("rejects a key that would not be index-safe", () => {
|
||||
const errors = validateManifest(
|
||||
withSettings({
|
||||
|
||||
@@ -183,13 +183,18 @@ describe("declaredFields", () => {
|
||||
host: {
|
||||
enableKey: "enableThing",
|
||||
enableLabelKey: "k",
|
||||
enableDescriptionKey: "d",
|
||||
fields: [{ key: "port", type: "number", labelKey: "k" }],
|
||||
},
|
||||
});
|
||||
|
||||
const fields = declaredFields(withHost, "host");
|
||||
expect(fields.map((f) => f.key)).toEqual(["enableThing", "port"]);
|
||||
expect(fields[0]).toMatchObject({ type: "boolean", default: false });
|
||||
expect(fields[0]).toMatchObject({
|
||||
type: "boolean",
|
||||
default: false,
|
||||
descriptionKey: "d",
|
||||
});
|
||||
});
|
||||
|
||||
it("finds a field by key", () => {
|
||||
|
||||
Reference in new issue
Block a user