feat: add slider field

This commit is contained in:
2026-08-23 05:18:10 +05:00
parent 7e391a420b
commit 3701fc8045
6 changed files with 123 additions and 11 deletions
+8 -2
View File
@@ -50,7 +50,7 @@ describe('реестр инструментов', () => {
expect(tool.description.length).toBeGreaterThan(0);
});
it('у select дефолт входит в options, у number дефолт в диапазоне', () => {
it('у select дефолт входит в options, у number/slider дефолт в диапазоне', () => {
for (const tool of TOOLS) {
for (const param of tool.params) {
if (param.type === 'select') {
@@ -61,6 +61,11 @@ describe('реестр инструментов', () => {
expect(param.min === undefined || param.default >= param.min).toBe(true);
expect(param.max === undefined || param.default <= param.max).toBe(true);
}
if (param.type === 'slider') {
expect(param.min).toBeLessThan(param.max);
expect(param.default).toBeGreaterThanOrEqual(param.min);
expect(param.default).toBeLessThanOrEqual(param.max);
}
if (param.type === 'color') {
expect(param.default).toMatch(/^#[0-9a-f]{6}$/i);
}
@@ -80,7 +85,8 @@ describe('реестр инструментов', () => {
const output = outputOf(tool);
if (output?.qualityParamId) {
const param = tool.params.find(
(p): p is Extract<ParamDef, { type: 'number' }> => p.id === output.qualityParamId
(p): p is Extract<ParamDef, { type: 'number' | 'slider' }> =>
p.id === output.qualityParamId
);
expect(param).toBeDefined();
}