@@ -196,4 +196,54 @@ describe('RightPanel - Zed-style Changes list', () => {
196196 expect ( ( API . sessions . getDiff as any ) . mock . calls . length ) . toBeGreaterThan ( 1 ) ;
197197 } ) ;
198198 } ) ;
199+
200+ it ( 'sorts paths in a git-like (codepoint) order' , async ( ) => {
201+ ( API . sessions . getDiff as any ) . mockResolvedValue ( {
202+ success : true ,
203+ data : {
204+ workingTree : {
205+ staged : [
206+ { path : '_config.yml' , type : 'modified' , additions : 3 , deletions : 2 } ,
207+ ] ,
208+ unstaged : [
209+ { path : '.github/workflows/pages.yml' , type : 'modified' , additions : 11 , deletions : 5 } ,
210+ { path : 'package.json' , type : 'modified' , additions : 4 , deletions : 1 } ,
211+ { path : 'source/about/index.md' , type : 'modified' , additions : 3 , deletions : 2 } ,
212+ ] ,
213+ untracked : [
214+ { path : 'dd.txt' , type : 'added' , additions : 6 , deletions : 0 } ,
215+ { path : 'WORKTREE_TEST.md' , type : 'added' , additions : 29 , deletions : 0 } ,
216+ ] ,
217+ } ,
218+ } ,
219+ } ) ;
220+
221+ const { container } = render ( < RightPanel { ...mockProps } /> ) ;
222+
223+ await waitFor ( ( ) => {
224+ expect ( screen . getByTestId ( 'right-panel-file-tracked-_config.yml' ) ) . toBeInTheDocument ( ) ;
225+ expect ( screen . getByTestId ( 'right-panel-file-tracked-.github/workflows/pages.yml' ) ) . toBeInTheDocument ( ) ;
226+ } ) ;
227+
228+ const trackedEls = Array . from (
229+ container . querySelectorAll ( 'button[data-testid^="right-panel-file-tracked-"]' )
230+ ) . filter ( ( el ) => ! el . getAttribute ( 'data-testid' ) ?. endsWith ( '-checkbox' ) ) ;
231+
232+ const trackedOrder = trackedEls . map ( ( el ) => el . getAttribute ( 'data-testid' ) ) ;
233+ expect ( trackedOrder ) . toEqual ( [
234+ 'right-panel-file-tracked-.github/workflows/pages.yml' ,
235+ 'right-panel-file-tracked-_config.yml' ,
236+ 'right-panel-file-tracked-package.json' ,
237+ 'right-panel-file-tracked-source/about/index.md' ,
238+ ] ) ;
239+
240+ const untrackedEls = Array . from (
241+ container . querySelectorAll ( 'button[data-testid^="right-panel-file-untracked-"]' )
242+ ) . filter ( ( el ) => ! el . getAttribute ( 'data-testid' ) ?. endsWith ( '-checkbox' ) ) ;
243+ const untrackedOrder = untrackedEls . map ( ( el ) => el . getAttribute ( 'data-testid' ) ) ;
244+ expect ( untrackedOrder ) . toEqual ( [
245+ 'right-panel-file-untracked-WORKTREE_TEST.md' ,
246+ 'right-panel-file-untracked-dd.txt' ,
247+ ] ) ;
248+ } ) ;
199249} ) ;
0 commit comments