experiment: better web picker using @pierre/tree (#31208)

This commit is contained in:
Luke Parker
2026-06-16 17:43:23 +02:00
committed by GitHub
parent 25cb2be619
commit 88f5b9a90e
39 changed files with 1297 additions and 211 deletions
@@ -0,0 +1,23 @@
import { expect, test } from "bun:test"
import { FileTree, type FileTreeDirectoryHandle } from "@pierre/trees"
test("reports directory expansion changes", () => {
const changes: Array<{ path: string; expanded: boolean }> = []
const tree = new FileTree({
paths: ["src/"],
onExpansionChange: (change) => changes.push(change),
})
const src = tree.getItem("src/")
if (!src || !src.isDirectory()) throw new Error("Expected src to be a directory")
const directory = src as FileTreeDirectoryHandle
directory.expand()
directory.collapse()
expect(changes).toEqual([
{ path: "src/", expanded: true },
{ path: "src/", expanded: false },
])
tree.cleanUp()
})