@@ -255,3 +255,80 @@ func TestSidebar_HandleClickType_NoWrap(t *testing.T) {
255255 result = sb .HandleClickType (paddingLeft + 1 , verticalStarY )
256256 assert .Equal (t , ClickStar , result , "star should still be clickable" )
257257}
258+
259+ func TestSidebar_HandleClickType_WorkingDir_Vertical (t * testing.T ) {
260+ t .Parallel ()
261+
262+ sess := session .New ()
263+ sessionState := service .NewSessionState (sess )
264+ sb := New (sessionState )
265+
266+ m := sb .(* model )
267+ m .sessionHasContent = true
268+ m .titleGenerated = true
269+ m .mode = ModeVertical
270+ m .width = 50
271+ m .sessionTitle = "Hi"
272+ m .workingDirectory = "~/projects/myapp"
273+
274+ paddingLeft := m .layoutCfg .PaddingLeft
275+
276+ // In vertical mode, working dir is at verticalStarY + titleLineCount + 1 (empty separator)
277+ titleLines := m .titleLineCount ()
278+ wdY := verticalStarY + titleLines + 1
279+
280+ // Click on the working directory line
281+ result := sb .HandleClickType (paddingLeft + 3 , wdY )
282+ assert .Equal (t , ClickWorkingDir , result , "click on working dir line should return ClickWorkingDir" )
283+
284+ // Click on the title line should still return ClickTitle
285+ result = sb .HandleClickType (paddingLeft + 3 , verticalStarY )
286+ assert .Equal (t , ClickTitle , result , "click on title should still return ClickTitle" )
287+
288+ // Click on the empty separator line should return ClickNone
289+ result = sb .HandleClickType (paddingLeft + 3 , verticalStarY + titleLines )
290+ assert .Equal (t , ClickNone , result , "click on separator line should return ClickNone" )
291+ }
292+
293+ func TestSidebar_HandleClickType_WorkingDir_Collapsed (t * testing.T ) {
294+ t .Parallel ()
295+
296+ sess := session .New ()
297+ sessionState := service .NewSessionState (sess )
298+ sb := New (sessionState )
299+
300+ m := sb .(* model )
301+ m .sessionHasContent = true
302+ m .titleGenerated = true
303+ m .mode = ModeCollapsed
304+ m .width = 50
305+ m .sessionTitle = "Hi"
306+ m .workingDirectory = "~/projects/myapp"
307+
308+ paddingLeft := m .layoutCfg .PaddingLeft
309+
310+ // In collapsed mode, title occupies 1 line, then working dir
311+ titleLines := m .titleLineCount ()
312+ assert .Equal (t , 1 , titleLines , "title should be on single line" )
313+
314+ // Click on the working directory line (right after title)
315+ result := sb .HandleClickType (paddingLeft + 3 , titleLines )
316+ assert .Equal (t , ClickWorkingDir , result , "click on working dir line should return ClickWorkingDir" )
317+
318+ // Click on the title should still return ClickTitle
319+ result = sb .HandleClickType (paddingLeft + 3 , 0 )
320+ assert .Equal (t , ClickTitle , result , "click on title should still return ClickTitle" )
321+ }
322+
323+ func TestSidebar_WorkingDirectory (t * testing.T ) {
324+ t .Parallel ()
325+
326+ sess := session .New ()
327+ sessionState := service .NewSessionState (sess )
328+ sb := New (sessionState )
329+
330+ m := sb .(* model )
331+ m .workingDirectory = "~/projects/myapp"
332+
333+ assert .Equal (t , "~/projects/myapp" , sb .WorkingDirectory ())
334+ }
0 commit comments