Use checkbox-tree library

This commit is contained in:
2026-07-11 21:28:45 -05:00
parent c32a984c8e
commit 291b6028f5
7 changed files with 20 additions and 51 deletions
+6 -1
View File
@@ -8,7 +8,7 @@ globalThis.document = dom.window.document;
globalThis.Element = dom.window.Element;
globalThis.localStorage = dom.window.localStorage;
const { CheckboxTree } = await import('../web/lib/checkbox-tree/checkbox-tree.js');
const { CheckboxTree } = await import('../web/vendor/checkbox-tree/checkbox-tree.js');
function createTree(options = {}) {
const container = document.createElement('div');
@@ -57,6 +57,11 @@ test('partial child selection makes the parent indeterminate', () => {
assert.deepEqual(tree.getSelectedIds(), ['first']);
});
test('can initially select every selectable node', () => {
const { tree } = createTree({ initiallySelected: true });
assert.deepEqual(tree.getSelectedIds(), ['parent', 'first', 'second']);
});
test('persists selection and collapsed branches per configured key', () => {
localStorage.clear();
const first = createTree({ storageKey: 'example-tree' });