fixes
This commit is contained in:
@@ -145,6 +145,7 @@ async fn test_cursor_navigation_in_input() {
|
||||
let mut app = TestAppBuilder::new()
|
||||
.with_chats(vec![create_test_chat("Chat 1", 101)])
|
||||
.selected_chat(101)
|
||||
.insert_mode()
|
||||
.build();
|
||||
|
||||
// Вводим текст "Hello"
|
||||
@@ -182,6 +183,7 @@ async fn test_home_end_in_input() {
|
||||
let mut app = TestAppBuilder::new()
|
||||
.with_chats(vec![create_test_chat("Chat 1", 101)])
|
||||
.selected_chat(101)
|
||||
.insert_mode()
|
||||
.build();
|
||||
|
||||
// Вводим текст
|
||||
@@ -206,6 +208,7 @@ async fn test_backspace_with_cursor() {
|
||||
let mut app = TestAppBuilder::new()
|
||||
.with_chats(vec![create_test_chat("Chat 1", 101)])
|
||||
.selected_chat(101)
|
||||
.insert_mode()
|
||||
.build();
|
||||
|
||||
// Вводим "Hello"
|
||||
@@ -238,6 +241,7 @@ async fn test_insert_char_at_cursor_position() {
|
||||
let mut app = TestAppBuilder::new()
|
||||
.with_chats(vec![create_test_chat("Chat 1", 101)])
|
||||
.selected_chat(101)
|
||||
.insert_mode()
|
||||
.build();
|
||||
|
||||
// Вводим "Hllo"
|
||||
@@ -259,25 +263,25 @@ async fn test_insert_char_at_cursor_position() {
|
||||
assert_eq!(app.cursor_position, 2);
|
||||
}
|
||||
|
||||
/// Test: Навигация вверх по сообщениям из пустого инпута
|
||||
/// Test: Normal mode автоматически входит в MessageSelection
|
||||
#[tokio::test]
|
||||
async fn test_up_arrow_selects_last_message_when_input_empty() {
|
||||
async fn test_normal_mode_auto_enters_message_selection() {
|
||||
let messages = vec![
|
||||
TestMessageBuilder::new("Msg 1", 1).outgoing().build(),
|
||||
TestMessageBuilder::new("Msg 2", 2).outgoing().build(),
|
||||
TestMessageBuilder::new("Msg 3", 3).outgoing().build(),
|
||||
];
|
||||
|
||||
|
||||
let mut app = TestAppBuilder::new()
|
||||
.with_chats(vec![create_test_chat("Chat 1", 101)])
|
||||
.selected_chat(101)
|
||||
.with_messages(101, messages)
|
||||
.build();
|
||||
|
||||
// Инпут пустой
|
||||
// Инпут пустой, Normal mode
|
||||
assert_eq!(app.message_input, "");
|
||||
|
||||
// Up - должен начать выбор сообщения (последнего)
|
||||
// Любая клавиша в Normal mode — auto-enters MessageSelection
|
||||
handle_main_input(&mut app, key(KeyCode::Up)).await;
|
||||
|
||||
// Проверяем что вошли в режим выбора сообщения
|
||||
|
||||
Reference in New Issue
Block a user