Skip to content

Commit 7211bc0

Browse files
committed
chore: add comments to make it clear how it works
1 parent 642f423 commit 7211bc0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/internal/utils/__tests__/flatten-children.test.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ describe('flattenChildren', () => {
2626
</Fragment>
2727
);
2828

29+
// Tests React 19+ behavior: uses Children.toArray() which does NOT flatten fragments
2930
describe('React 19+', () => {
3031
beforeEach(() => {
32+
// Mock React.version to trigger Children.toArray() code path
3133
Object.defineProperty(React, 'version', {
3234
value: '19.0.0',
3335
writable: true,
@@ -45,8 +47,10 @@ describe('flattenChildren', () => {
4547
});
4648
});
4749

50+
// Tests React 16-18 behavior: uses react-keyed-flatten-children which DOES flatten fragments
4851
describe('React 16-18', () => {
4952
beforeEach(() => {
53+
// Mock React.version to trigger react-keyed-flatten-children code path
5054
Object.defineProperty(React, 'version', {
5155
value: '18.2.0',
5256
writable: true,

0 commit comments

Comments
 (0)