From 538ac0716ede850c567e195da00806b66ef8465f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=20Houl=C3=A9?= Date: Thu, 19 Mar 2026 17:11:17 +0100 Subject: [PATCH] Add tests Co-authored-by: Antonio Scandurra Co-authored-by: Anthony Eid --- crates/editor/src/editor_tests.rs | 42 +++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/crates/editor/src/editor_tests.rs b/crates/editor/src/editor_tests.rs index f497881531bf4ba39cb22aca4cf90923f7d10b81..18e422b5304ed4d74fb2998020e91095cfc9eed1 100644 --- a/crates/editor/src/editor_tests.rs +++ b/crates/editor/src/editor_tests.rs @@ -7297,6 +7297,48 @@ async fn test_rewrap(cx: &mut TestAppContext) { also very long and should not merge with the numbered item.ˇ» "}, + markdown_language.clone(), + &mut cx, + ); + + // Test that empty selection rewrap on a numbered list item does not merge adjacent items + assert_rewrap( + indoc! {" + 1. This is the first numbered list item that is very long and needs to be wrapped properly. + 2. ˇThis is the second numbered list item that is also very long and needs to be wrapped. + 3. This is the third numbered list item, shorter. + "}, + indoc! {" + 1. This is the first numbered list item + that is very long and needs to be + wrapped properly. + 2. ˇThis is the second numbered list item + that is also very long and needs to + be wrapped. + 3. This is the third numbered list item, + shorter. + "}, + markdown_language.clone(), + &mut cx, + ); + + // Test that empty selection rewrap on a bullet list item does not merge adjacent items + assert_rewrap( + indoc! {" + - This is the first bullet item that is very long and needs wrapping properly here. + - ˇThis is the second bullet item that is also very long and needs to be wrapped. + - This is the third bullet item, shorter. + "}, + indoc! {" + - This is the first bullet item that is + very long and needs wrapping properly + here. + - ˇThis is the second bullet item that is + also very long and needs to be + wrapped. + - This is the third bullet item, + shorter. + "}, markdown_language, &mut cx, );