Files
NODEDC_DESIGN_GUIDELINE/scripts/tree-selection.test.mjs
T

11 lines
614 B
JavaScript

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']);
});