Support controlled multi-selection and visible ranges in Tree

This commit is contained in:
Codex
2026-11-14 23:05:56 +03:00
parent d8ed37e09d
commit d7885fe098
7 changed files with 36 additions and 10 deletions
+10
View File
@@ -0,0 +1,10 @@
import {test} from 'node:test';
import assert from 'node:assert/strict';
import {treeSelectionRange} from '../packages/ui-react/dist/treeSelectionRange.js';
test('tree ranges include endpoints in both directions and only visible rows',()=>{
const visible=['project','group','first','last','other'];
assert.deepEqual(treeSelectionRange(visible,'first','last'),['first','last']);
assert.deepEqual(treeSelectionRange(visible,'last','first'),['first','last']);
assert.deepEqual(treeSelectionRange(visible,'filtered-out','last'),['last']);
assert.deepEqual(treeSelectionRange(visible,null,'first'),['first']);
});