File tree 1 file changed +32
-0
lines changed
1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -360,3 +360,35 @@ fn test_string_list_filter() {
360
360
assert ! ( !mode. entries. is_empty( ) ) ;
361
361
assert_eq ! ( mode. entries. len( ) , 3 ) ;
362
362
}
363
+
364
+ #[ test]
365
+ fn test_value_truncation_and_name_padding ( ) {
366
+ let mut mode = InteractiveMode {
367
+ entries : vec ! [
368
+ ( "short" . to_string( ) , "short_value" . to_string( ) ) ,
369
+ ( "very_long_name" . to_string( ) , "value_that_needs_truncation" . to_string( ) ) ,
370
+ ] ,
371
+ truncation_len : 10 ,
372
+ current_index : 1 ,
373
+ scroll_offset : 0 ,
374
+ value_scroll_offset : 0 ,
375
+ ..Default :: default ( )
376
+ } ;
377
+
378
+ let area = Rect :: new ( 0 , 0 , 100 , 30 ) ;
379
+ let mut buffer = Buffer :: empty ( area) ;
380
+ Widget :: render ( & mut mode, area, & mut buffer) ;
381
+
382
+ // Convert buffer content to string for easier testing
383
+ let content = buffer
384
+ . content
385
+ . iter ( )
386
+ . map ( |cell| cell. symbol ( ) . to_string ( ) )
387
+ . collect :: < String > ( ) ;
388
+
389
+ // Test value truncation (line 131)
390
+ assert ! ( content. contains( "value_that..." ) ) ;
391
+
392
+ // Test name padding (line 134)
393
+ assert ! ( content. contains( & format!( "{:38}" , "very_long_name" ) ) ) ;
394
+ }
You can’t perform that action at this time.
0 commit comments