hi
` is unchanged. + +Its one bounded cost: a whitespace-only run BETWEEN two siblings survives as a +single space, so a pretty-printed `A kind:'html' page — native HTML tags and the blocks' structured props.
`, + ); + expect(kids).toEqual([ + 'A ', + expect.any(Object), + " page — native HTML tags and the blocks' structured props.", + ]); + expect(flatten({ type: 'p', children: kids })).toBe( + "A kind:'html' page — native HTML tags and the blocks' structured props.", + ); + }); + + it("case 2 — 'in the html tier.' keeps both spaces around the element", () => { + const kids = childrenOf(`A\n\n long run x\n tail
'); + expect(kids).toEqual(['A long run ', expect.any(Object), ' tail']); + }); + + it('still drops the edge space at the parent’s own start and end', () => { + // The half of `.trim()` that was correct. Nothing here is adjacent to a + // sibling, so nothing is kept. + expect(childrenOf('Hello
')).toEqual(['Hello']); + // A pretty-printed element child: the whitespace-only runs sit at the + // parent's edges, so they leave no string children behind at all. + expect(childrenOf('\n x\n
')).toEqual([expect.any(Object)]); + }); + + it('keeps the space when the element is the run’s only neighbour', () => { + expect(childrenOf('Hello x
')).toEqual(['Hello ', expect.any(Object)]); + expect(childrenOf('x tail
')).toEqual([expect.any(Object), ' tail']); + }); + + describe('the bound on the rule’s known over-generosity (a pretty-printedA kind:'html' page — native HTML tags.
`)).toBe( + "A kind:'html' page — native HTML tags.", + ); + // The reported rendering, stated so it cannot come back unnoticed. + expect(renderedText(`A kind:'html' page — native HTML tags.
`)).not.toBe( + "Akind:'html'page — native HTML tags.", + ); + }); + + it('renders both list sentences with their spaces intact', () => { + expect(renderedText(`hi
` stays `hi`. A whitespace-only run survives + // as one space only when it sits BETWEEN siblings — that is the bounded + // over-generosity of this rule inside block containers like `