Skip to content

Commit 91b8b90

Browse files
committed
GridCommands: fix selectByIndex schema
1 parent d472158 commit 91b8b90

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

packages/devextreme/js/__internal/grids/grid_core/ai_assistant/commands/__tests__/selection.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,10 @@ describe('selectByIndexesCommand', () => {
276276
expect(selectByIndexesCommand.schema.safeParse({}).success).toBe(false);
277277
});
278278

279+
it('rejects when indexes is an empty array', () => {
280+
expect(selectByIndexesCommand.schema.safeParse({ indexes: [] }).success).toBe(false);
281+
});
282+
279283
it('rejects negative indexes', () => {
280284
expect(selectByIndexesCommand.schema.safeParse({ indexes: [-1] }).success).toBe(false);
281285
});

packages/devextreme/js/__internal/grids/grid_core/ai_assistant/commands/selection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const selectByKeysCommand = defineGridCommand({
4343

4444
const selectByIndexesCommandSchema = z.object({
4545
// eslint-disable-next-line spellcheck/spell-checker
46-
indexes: z.array(z.number().int().nonnegative()),
46+
indexes: z.array(z.number().int().nonnegative()).min(1),
4747
}).strict();
4848

4949
export const selectByIndexesCommand = defineGridCommand({

0 commit comments

Comments
 (0)