mirror of
https://github.com/Ku6epXBOCTuK/easy-png-tools.git
synced 2026-11-13 17:08:20 +00:00
feat: add tool schema layout
This commit is contained in:
@@ -26,7 +26,10 @@ const frameSchema = toolSchema<FrameParams>(
|
||||
],
|
||||
}),
|
||||
},
|
||||
{ layout: { group: "frame", cols: 2 }, label: "Frame" },
|
||||
{
|
||||
layout: { groups: [{ title: "Frame", fields: ["thickness", "color"] }] },
|
||||
label: "Frame",
|
||||
},
|
||||
);
|
||||
|
||||
describe("registry-schema: дефолты из схемы", () => {
|
||||
@@ -40,6 +43,30 @@ describe("registry-schema: дефолты из схемы", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("registry-schema: раскладка (schema.layout)", () => {
|
||||
it("toolSchema сохраняет группы полей", () => {
|
||||
expect(frameSchema.layout).toEqual({
|
||||
groups: [{ title: "Frame", fields: ["thickness", "color"] }],
|
||||
});
|
||||
});
|
||||
|
||||
it("обе схемы без layout не добавляют layout", () => {
|
||||
const plain = toolSchema<FrameParams>({
|
||||
thickness: field.slider({ min: 1, max: 500, default: 5 }),
|
||||
color: field.color({ default: "#000000" }),
|
||||
enabled: field.checkbox({ default: true }),
|
||||
count: field.select({
|
||||
default: "two",
|
||||
options: [
|
||||
{ value: "one", label: "One" },
|
||||
{ value: "two", label: "Two" },
|
||||
],
|
||||
}),
|
||||
});
|
||||
expect(plain.layout).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe("registry-schema: санитайз", () => {
|
||||
it("пропускает валидные значения", () => {
|
||||
const out = sanitizeSchemaParams(frameSchema, {
|
||||
|
||||
Reference in New Issue
Block a user