Uh oh!
There was an error while loading. Please reload this page.
fix(transient-render-engine): preserve nested inline boundary spaces - #34
Conversation
Keep boundary spaces inside named inline wrappers until the parent phrasing node collapses sibling whitespace. Add a regression test for nested inline tags that previously rendered "foobar" instead of "foo bar". Made-with: Cursor
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@## main #34 +/- ##
=======================================
Coverage 98.65% 98.65% =======================================
Files 140 140 Lines 2083 2085 +2 Branches 633 635 +2 =======================================
+ Hits 2055 2057 +2
Misses 27 27 Partials 1 1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
5ZYSZ3K
commented
Apr 13, 2026
Hi @leineveber, thanks for the contribution! |
| it('should preserve boundary spaces wrapped in nested inline phrasing tags', () => { | ||
| const ttree = makeTTree( | ||
| '<span><span><strong>foo</strong> </span><span><strong>bar</strong></span></span>' | ||
| ); | ||
| const [firstSpan, secondSpan] = ttree.children; | ||
| expect(firstSpan.tagName).toBe('span'); | ||
| expect(firstSpan.children).toHaveLength(2); | ||
| expect((firstSpan.children[0] as TTextImpl).data).toBe('foo'); | ||
| expect((firstSpan.children[1] as TTextImpl).data).toBe(' '); | ||
| expect(secondSpan.tagName).toBe('span'); | ||
| expect(secondSpan.children).toHaveLength(1); | ||
| expect((secondSpan.children[0] as TTextImpl).data).toBe('bar'); | ||
| }); |
There was a problem hiding this comment.
We could use a snaphot, like every other test in this file.
There was a problem hiding this comment.
Also add a test that proves that two spaces are still collapsed into one. In other words
the following:
<span><span><strong>foo</strong></span><span><strong>bar</strong></span></span>renders the same as your example:
<span><span><strong>foo</strong></span><span><strong>bar</strong></span></span>leineveber
commented
Apr 14, 2026
hi @5ZYSZ3K, were you able to check that from your side? |
leineveber
commented
Apr 14, 2026
@jsamr thanks for your comments! I'll fix that as soon as possible |
leineveber
commented
Apr 20, 2026
@jsamr hi! fixed, could u take a look? |
leineveber
commented
Apr 29, 2026
@5ZYSZ3K hi! seems like PR is already approved, can we get it merged? |
Uh oh!
There was an error while loading. Please reload this page.
5ZYSZ3K
commented
Apr 29, 2026
Merged |
Summary
Fix whitespace collapsing for nested inline phrasing nodes so boundary spaces inside named inline wrappers like span are preserved until the parent phrasing node collapses sibling whitespace correctly.
Adds a regression test for nested inline tags that previously rendered foo bar as foobar.
Closes#33