#![cfg(feature = "terminal")]
use ratatui_toolkit::termtui::TermTui;
#[tokio::test]
async fn test_spawn_echo() {
let term = TermTui::spawn_with_command("Test", "echo", &["hello"]).unwrap();
tokio::time::sleep(tokio::time::Duration::from_millis(300)).await;
assert_eq!(term.title, "Test");
}
#[tokio::test]
async fn test_spawn_shell_and_send_input() {
let term = TermTui::spawn_with_command("Shell", "sh", &["-c", "cat"]).unwrap();
tokio::time::sleep(tokio::time::Duration::from_millis(200)).await;
term.send_input("hello\n");
tokio::time::sleep(tokio::time::Duration::from_millis(200)).await;
assert_eq!(term.title, "Shell");
}
#[tokio::test]
async fn test_copy_mode_on_spawned_terminal() {
let mut term = TermTui::spawn_with_command("Test", "echo", &["test output"]).unwrap();
tokio::time::sleep(tokio::time::Duration::from_millis(300)).await;
term.enter_copy_mode();
assert!(term.copy_mode.is_active());
let cursor = term.copy_mode.cursor();
assert!(cursor.is_some());
}