Skip to content

Commit 783df83

Browse files
committed
1 parent cfbfb51 commit 783df83

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

src/Collapse.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ const Collapse = React.forwardRef<HTMLDivElement, CollapseProps>((props, ref) =>
173173
});
174174

175175
const children = Array.isArray(items)
176-
? convertItemsToNodes(items)
176+
? [convertItemsToNodes(items), rawChildren]
177177
: toArray(rawChildren).map(getNewChild);
178178

179179
// ======================== Render ========================

src/interface.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ export interface CollapseProps {
2424
destroyInactivePanel?: boolean;
2525
expandIcon?: (props: object) => React.ReactNode;
2626
collapsible?: CollapsibleType;
27-
/**
28-
* @deprecated use `items` instead, will be removed in `v4.0.0`
29-
*/
3027
children?: React.ReactNode;
3128
/**
3229
* Collapse items content

tests/index.spec.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,5 +790,22 @@ describe('collapse', () => {
790790
);
791791
expect(container.firstChild).toMatchSnapshot();
792792
});
793+
794+
it('should support custom child', () => {
795+
const { container } = render(
796+
<Collapse
797+
items={[
798+
{
799+
key: '1',
800+
header: 'title',
801+
children: 'first',
802+
},
803+
]}
804+
>
805+
<a className="custom-child">custom-child</a>
806+
</Collapse>,
807+
);
808+
expect(container.querySelector('.custom-child')?.innerHTML).toBe('custom-child');
809+
});
793810
});
794811
});

0 commit comments

Comments
 (0)