From 791e144fd75ced93dcb97e5ddada8ff6fdbfe4f8 Mon Sep 17 00:00:00 2001 From: Reuben Grinberg Date: Wed, 11 Nov 2026 10:37:12 +0000 Subject: [PATCH] Compare: flip the inserted-section pin to the fixed behaviour (#5667, fixed on main by #5734) --- crates/engine/src/cmd/tools/tests.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/crates/engine/src/cmd/tools/tests.rs b/crates/engine/src/cmd/tools/tests.rs index c5e45521ea..96c43cb519 100644 --- a/crates/engine/src/cmd/tools/tests.rs +++ b/crates/engine/src/cmd/tools/tests.rs @@ -132,13 +132,14 @@ fn compare_pins_the_terminal_deleted_paragraph_limitation() { #[test] fn compare_pins_rejecting_an_inserted_section_restyles_the_next_paragraph() { - // Characterizes a known limitation recorded on `mark_block` (compare.rs): rejecting an - // inserted paragraph that carries a section break. `resolve`'s `remove_empty_para` refuses - // paragraphs carrying a section, so once the inserted paragraph's text is rejected the empty - // paragraph is joined into the next one, which takes its properties. Here the original "Body" - // is Heading 1; after Reject All it carries the inserted paragraph's Normal properties. The - // real fix belongs to `resolve` (`remove_empty_para`/`join_next_para`): flip this test when it - // lands. + // Pins the fixed behaviour for rejecting an inserted paragraph that carries a section + // break. This was a known limitation recorded on `mark_block` (compare.rs): `resolve`'s + // `remove_empty_para` refused paragraphs carrying a section, so once the inserted + // paragraph's text was rejected the empty paragraph was joined into the next one, which + // took its properties ("Body" came back Normal instead of its original Heading 1). Fixed + // on main by #5734 (issue #5667): `resolve_para` now removes the section break first, so + // the empty paragraph goes whole and the following paragraph keeps its own properties. + // After Reject All the original is restored exactly. let mut original = Document::from_text("Intro\nBody"); original.para_mut(StoryRef::Body, &wordcraft_doc::Path::top(1)).unwrap().props.style = Some("Heading1".into()); let mut s = Session::new(original); @@ -161,8 +162,8 @@ fn compare_pins_rejecting_an_inserted_section_restyles_the_next_paragraph() { assert_eq!(body.plain_text(), "Body"); assert_eq!( body.props.style.as_deref(), - Some("Normal"), - "the current (wrong) outcome: the following paragraph took the inserted sectioned paragraph's properties" + Some("Heading1"), + "the following paragraph keeps its own properties (fixed on main by #5734)" ); }