@@ -112,13 +112,14 @@ describe('createStreamingRenderer', () => {
112112 expect ( split ! [ 1 ] ) . toBe ( '<p>Second paragraph</p>' ) ;
113113 } ) ;
114114
115- test ( 'should preserve both paragraphs in textContent' , ( ) => {
115+ test ( 'should preserve newline between paragraphs in textContent' , ( ) => {
116116 const { container, nextOptions, renderer } = setup ( ) ;
117117
118118 renderer . next ( 'First\n\nSecond' , nextOptions ( ) ) ;
119119
120120 expect ( container . textContent ) . toContain ( 'First' ) ;
121121 expect ( container . textContent ) . toContain ( 'Second' ) ;
122+ expect ( container . textContent ) . toMatch ( / F i r s t \s + S e c o n d / u) ;
122123 } ) ;
123124
124125 test ( 'should split three paragraphs with two committed and one active' , ( ) => {
@@ -133,6 +134,15 @@ describe('createStreamingRenderer', () => {
133134 expect ( split ! [ 0 ] ) . toContain ( 'Block B' ) ;
134135 expect ( split ! [ 1 ] ) . toBe ( '<p>Block C</p>' ) ;
135136 } ) ;
137+
138+ test ( 'should preserve newline in textContent for code span followed by paragraph' , ( ) => {
139+ const { container, nextOptions, renderer } = setup ( ) ;
140+
141+ renderer . next ( '`t=undefined`\n\nA quick' , nextOptions ( ) ) ;
142+
143+ // The \n between the two <p> blocks must survive the committed/active split.
144+ expect ( container . textContent ) . toMatch ( / t = u n d e f i n e d \n A q u i c k / u) ;
145+ } ) ;
136146 } ) ;
137147
138148 describe ( 'htmlFlow blocks' , ( ) => {
0 commit comments