@@ -169,7 +169,7 @@ func TestTUIQueueMouseClickSelectsVisibleRow(t *testing.T) {
169169 m := newTuiModel ("http://localhost" )
170170 m .currentView = tuiViewQueue
171171 m .width = 120
172- m .height = 14
172+ m .height = 20
173173 m .jobs = []storage.ReviewJob {
174174 makeJob (1 ),
175175 makeJob (2 ),
@@ -195,7 +195,7 @@ func TestTUIQueueMouseHeaderClickDoesNotSort(t *testing.T) {
195195 m := newTuiModel ("http://localhost" )
196196 m .currentView = tuiViewQueue
197197 m .width = 120
198- m .height = 14
198+ m .height = 20
199199 m .jobs = []storage.ReviewJob {
200200 makeJob (3 ),
201201 makeJob (1 ),
@@ -259,7 +259,7 @@ func TestTUIQueueMouseClickScrolledWindow(t *testing.T) {
259259 m := newTuiModel ("http://localhost" )
260260 m .currentView = tuiViewQueue
261261 m .width = 120
262- m .height = 12 // small terminal
262+ m .height = 16 // small but not compact (compact hides headers, changing click offsets)
263263
264264 // Create more jobs than fit on screen.
265265 for i := range 20 {
@@ -307,6 +307,94 @@ func TestTUIQueueMouseClickScrolledWindow(t *testing.T) {
307307 }
308308}
309309
310+ func TestTUIQueueCompactMode (t * testing.T ) {
311+ m := newTuiModel ("http://localhost" )
312+ m .currentView = tuiViewQueue
313+ m .width = 80
314+ m .height = 10 // compact mode (< 15)
315+
316+ for i := range 5 {
317+ m .jobs = append (m .jobs , makeJob (int64 (i + 1 )))
318+ }
319+ m .selectedIdx = 0
320+ m .selectedJobID = 1
321+
322+ output := m .View ()
323+
324+ // Should have the title line
325+ if ! strings .Contains (output , "roborev queue" ) {
326+ t .Error ("compact mode should show title" )
327+ }
328+ // Should NOT have the table header
329+ if strings .Contains (output , "JobID" ) {
330+ t .Error ("compact mode should hide table header" )
331+ }
332+ // Should NOT have help footer keys
333+ if strings .Contains (output , "navigate" ) {
334+ t .Error ("compact mode should hide help footer" )
335+ }
336+ // Should NOT have daemon status line
337+ if strings .Contains (output , "Daemon:" ) {
338+ t .Error ("compact mode should hide status line" )
339+ }
340+
341+ // Mouse click at y=1 (first data row in compact mode) should select first job
342+ m .selectedIdx = 2
343+ m .selectedJobID = 3
344+ m2 , _ := updateModel (t , m , mouseLeftClick (4 , 1 ))
345+ if m2 .selectedJobID != 1 {
346+ t .Errorf ("compact mouse click at y=1: expected job 1, got %d" , m2 .selectedJobID )
347+ }
348+ }
349+
350+ func TestTUIQueueDistractionFreeToggle (t * testing.T ) {
351+ m := newTuiModel ("http://localhost" )
352+ m .currentView = tuiViewQueue
353+ m .width = 120
354+ m .height = 30 // tall enough for normal mode
355+
356+ for i := range 5 {
357+ m .jobs = append (m .jobs , makeJob (int64 (i + 1 )))
358+ }
359+ m .selectedIdx = 0
360+ m .selectedJobID = 1
361+
362+ // Normal mode: should show chrome
363+ output := m .View ()
364+ if ! strings .Contains (output , "JobID" ) {
365+ t .Error ("normal mode should show table header" )
366+ }
367+ if ! strings .Contains (output , "navigate" ) {
368+ t .Error ("normal mode should show help footer" )
369+ }
370+
371+ // Toggle distraction-free with 'D'
372+ m2 , _ := updateModel (t , m , tea.KeyMsg {Type : tea .KeyRunes , Runes : []rune {'D' }})
373+ if ! m2 .distractionFree {
374+ t .Fatal ("D should toggle distraction-free on" )
375+ }
376+ output = m2 .View ()
377+ if strings .Contains (output , "JobID" ) {
378+ t .Error ("distraction-free should hide table header" )
379+ }
380+ if strings .Contains (output , "navigate" ) {
381+ t .Error ("distraction-free should hide help footer" )
382+ }
383+ if strings .Contains (output , "Daemon:" ) {
384+ t .Error ("distraction-free should hide status line" )
385+ }
386+
387+ // Toggle back off
388+ m3 , _ := updateModel (t , m2 , tea.KeyMsg {Type : tea .KeyRunes , Runes : []rune {'D' }})
389+ if m3 .distractionFree {
390+ t .Fatal ("D should toggle distraction-free off" )
391+ }
392+ output = m3 .View ()
393+ if ! strings .Contains (output , "JobID" ) {
394+ t .Error ("should show table header after toggling off" )
395+ }
396+ }
397+
310398func TestTUITasksMouseClickSelectsRow (t * testing.T ) {
311399 m := newTuiModel ("http://localhost" )
312400 m .currentView = tuiViewTasks
0 commit comments