@@ -3,6 +3,7 @@ import { afterEach, describe, expect, test } from 'bun:test'
33import { FreebuffSession , requireFreebuffBinary } from '../utils'
44
55const TEST_TIMEOUT = 60_000
6+ const SESSION_HEIGHT = 40
67
78/**
89 * Commands that should be REMOVED in Freebuff.
@@ -51,11 +52,13 @@ describe('Freebuff: Slash Commands', () => {
5152 'slash command menu does not show removed commands' ,
5253 async ( ) => {
5354 const binary = requireFreebuffBinary ( )
54- session = await FreebuffSession . start ( binary , { waitSeconds : 5 } )
55+ session = await FreebuffSession . start ( binary , { waitSeconds : 5 , height : SESSION_HEIGHT } )
5556
5657 // Type "/" to trigger the slash command autocomplete menu
57- await session . send ( '/' , { noEnter : true } )
58- const output = await session . capture ( 2 )
58+ // Use sendKey instead of send to avoid C-u clearing keystroke that
59+ // interferes with opentui's input handling in newer versions
60+ await session . sendKey ( '/' )
61+ const output = await session . capture ( 4 )
5962
6063 // Removed commands should NOT appear in the autocomplete menu
6164 for ( const cmd of REMOVED_COMMANDS ) {
@@ -71,11 +74,11 @@ describe('Freebuff: Slash Commands', () => {
7174 'slash command menu shows kept commands' ,
7275 async ( ) => {
7376 const binary = requireFreebuffBinary ( )
74- session = await FreebuffSession . start ( binary , { waitSeconds : 5 } )
77+ session = await FreebuffSession . start ( binary , { waitSeconds : 5 , height : SESSION_HEIGHT } )
7578
7679 // Type "/" to trigger the slash command autocomplete menu
77- await session . send ( '/' , { noEnter : true } )
78- const output = await session . capture ( 2 )
80+ await session . sendKey ( '/' )
81+ const output = await session . capture ( 4 )
7982
8083 // Kept commands SHOULD appear in the autocomplete menu
8184 for ( const cmd of KEPT_COMMANDS ) {
@@ -90,11 +93,12 @@ describe('Freebuff: Slash Commands', () => {
9093 'no mode-related slash commands are visible' ,
9194 async ( ) => {
9295 const binary = requireFreebuffBinary ( )
93- session = await FreebuffSession . start ( binary , { waitSeconds : 5 } )
96+ session = await FreebuffSession . start ( binary , { waitSeconds : 5 , height : SESSION_HEIGHT } )
9497
9598 // Type "/mode" to check for mode commands
96- await session . send ( '/mode' , { noEnter : true } )
97- const output = await session . capture ( 2 )
99+ // Use sendKey for the full string to avoid C-u clearing the input
100+ await session . sendKey ( '/mode' )
101+ const output = await session . capture ( 4 )
98102
99103 // Mode commands should not exist in Freebuff
100104 expect ( output ) . not . toContain ( 'mode:max' )
0 commit comments