@@ -339,6 +339,77 @@ describe("FileTreePanel", () => {
339339 } ) ;
340340 } ) ;
341341
342+ it ( "restores per-type icon tone classes for tree rows and search results" , async ( ) => {
343+ const searchFiles = [
344+ { path : "src/app.tsx" , name : "app.tsx" , kind : "file" } ,
345+ { path : "src/config.json" , name : "config.json" , kind : "file" } ,
346+ { path : "src/README.md" , name : "README.md" , kind : "file" } ,
347+ { path : "src/logo.svg" , name : "logo.svg" , kind : "file" } ,
348+ { path : "src/notes.bin" , name : "notes.bin" , kind : "file" } ,
349+ ] ;
350+ const sendCommand = vi . fn ( ) . mockImplementation ( async ( op : string , args : { query ?: string } ) => {
351+ if ( op === "file.search" ) {
352+ const query = args . query ?. toLowerCase ( ) ?? "" ;
353+ return {
354+ files : searchFiles . filter ( ( item ) => item . name . toLowerCase ( ) . includes ( query ) ) ,
355+ } ;
356+ }
357+
358+ return { ok : true } ;
359+ } ) ;
360+ const store = createStore ( ) ;
361+ store . set ( wsClientAtom , { sendCommand } as never ) ;
362+ store . set (
363+ fileTreeAtomFamily ( "ws-test" ) ,
364+ new Map ( [
365+ [
366+ "." ,
367+ [
368+ {
369+ path : "src" ,
370+ name : "src" ,
371+ kind : "dir" ,
372+ children : [
373+ { path : "src/app.tsx" , name : "app.tsx" , kind : "file" } ,
374+ { path : "src/config.json" , name : "config.json" , kind : "file" } ,
375+ { path : "src/README.md" , name : "README.md" , kind : "file" } ,
376+ { path : "src/logo.svg" , name : "logo.svg" , kind : "file" } ,
377+ { path : "src/notes.bin" , name : "notes.bin" , kind : "file" } ,
378+ ] ,
379+ } ,
380+ ] ,
381+ ] ,
382+ ] )
383+ ) ;
384+
385+ render (
386+ < Provider store = { store } >
387+ < FileTreePanel workspaceId = "ws-test" />
388+ </ Provider >
389+ ) ;
390+
391+ const folderLabel = screen . getByText ( "src" ) ;
392+ expect ( folderLabel . previousElementSibling ) . toHaveClass ( "tree-icon" , "folder" ) ;
393+
394+ await screen . findByText ( "app.tsx" ) ;
395+
396+ expect ( screen . getByText ( "app.tsx" ) . previousElementSibling ) . toHaveClass ( "tree-icon" , "code" ) ;
397+ expect ( screen . getByText ( "config.json" ) . previousElementSibling ) . toHaveClass ( "tree-icon" , "data" ) ;
398+ expect ( screen . getByText ( "README.md" ) . previousElementSibling ) . toHaveClass ( "tree-icon" , "doc" ) ;
399+ expect ( screen . getByText ( "logo.svg" ) . previousElementSibling ) . toHaveClass ( "tree-icon" , "media" ) ;
400+ expect ( screen . getByText ( "notes.bin" ) . previousElementSibling ) . toHaveClass ( "tree-icon" , "file" ) ;
401+
402+ fireEvent . change ( screen . getByPlaceholderText ( "action.search_files" ) , {
403+ target : { value : "logo" } ,
404+ } ) ;
405+
406+ const searchLabel = await screen . findByText ( "logo.svg" ) ;
407+ expect ( searchLabel . closest ( ".tree-search-labels" ) ?. previousElementSibling ) . toHaveClass (
408+ "tree-icon" ,
409+ "media"
410+ ) ;
411+ } ) ;
412+
342413 it ( "opens the new file dialog from the toolbar and dispatches file.create" , async ( ) => {
343414 const sendCommand = vi
344415 . fn ( )
0 commit comments