зеркало из
https://github.com/glebtv/tui-textarea.git
synced 2026-09-03 22:35:50 +03:00
chore/integrate-open-prs (#5)
* docs: integrate upstream PR #116 * feat: integrate upstream PR #113 * chore: add portable-atomic for viewport atomics (upstream PR #111) * fix(examples): integrate upstream PR #100 * fix(word): integrate upstream PR #98 * fix(widget): handle wide unicode char widths in horizontal scroll (upstream PR #94) * feat(highlight): integrate upstream PR #93 * chore(release): prepare v0.8.0 docs and CI-clean merged upstream updates * docs(license): rename LICENSE.txt to LICENSE and fix header capitalization
Этот коммит содержится в:
@@ -1437,6 +1437,44 @@ fn test_delete_selection_before_insert() {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_clear_on_empty_text() {
|
||||
let mut t = TextArea::default();
|
||||
|
||||
let was_cleared = t.clear();
|
||||
assert!(!was_cleared);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_clear_text() {
|
||||
let mut t = TextArea::default();
|
||||
let input = "
|
||||
Hello world
|
||||
|
||||
Again
|
||||
";
|
||||
t.insert_str(input);
|
||||
let was_cleared = t.clear();
|
||||
assert!(
|
||||
t.lines().join("\n").is_empty(),
|
||||
"Textarea should be empty after clearing the text"
|
||||
);
|
||||
assert!(was_cleared);
|
||||
|
||||
t.undo();
|
||||
assert_eq!(
|
||||
t.lines().join("\n"),
|
||||
input,
|
||||
"Textare should have the previous content before the reset. Orginal input: {input}",
|
||||
);
|
||||
|
||||
t.redo();
|
||||
assert!(
|
||||
t.lines().join("\n").is_empty(),
|
||||
"Textarea should be empty after clearing the text again"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_undo_redo_stop_selection() {
|
||||
fn check(t: &mut TextArea, f: fn(&mut TextArea) -> bool) {
|
||||
|
||||
Ссылка в новой задаче
Block a user