| 3645 | |
| 3646 | #[test] |
| 3647 | fn test_undo_grouping_backspace() { |
| 3648 | let mut state = TextEditState::default(); |
| 3649 | state.text = "hello".to_string(); |
| 3650 | state.cursor_pos = 5; |
| 3651 | |
| 3652 | // Backspace 3 times |
| 3653 | state.push_undo(UndoActionKind::Backspace); |
| 3654 | state.backspace(); |
| 3655 | state.push_undo(UndoActionKind::Backspace); |
| 3656 | state.backspace(); |
| 3657 | state.push_undo(UndoActionKind::Backspace); |
| 3658 | state.backspace(); |
| 3659 | assert_eq!(state.text, "he"); |
| 3660 | |
| 3661 | // Should undo all backspaces at once |
| 3662 | assert!(state.undo()); |
| 3663 | assert_eq!(state.text, "hello"); |
| 3664 | } |
| 3665 | |
| 3666 | #[test] |
| 3667 | fn test_undo_different_kinds_not_grouped() { |