mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 02:59:04 +08:00
* fix: Pass custom prefixCls to Typography from Base (#38580) * test: Added test for typography custom prefixCls
This commit is contained in:
parent
08e4598baa
commit
52dedca8ed
@ -277,7 +277,7 @@ const Base = React.forwardRef<HTMLElement, BlockProps>((props, ref) => {
|
||||
const cssLineClamp = mergedEnableEllipsis && rows > 1 && cssEllipsis;
|
||||
|
||||
// >>>>> Expand
|
||||
const onExpandClick: React.MouseEventHandler<HTMLElement> = e => {
|
||||
const onExpandClick: React.MouseEventHandler<HTMLElement> = (e) => {
|
||||
setExpanded(true);
|
||||
ellipsisConfig.onExpand?.(e);
|
||||
};
|
||||
@ -510,6 +510,7 @@ const Base = React.forwardRef<HTMLElement, BlockProps>((props, ref) => {
|
||||
},
|
||||
className,
|
||||
)}
|
||||
prefixCls={customizePrefixCls}
|
||||
style={{
|
||||
...style,
|
||||
WebkitLineClamp: cssLineClamp ? rows : undefined,
|
||||
|
20
components/typography/__tests__/prefixCls.test.tsx
Normal file
20
components/typography/__tests__/prefixCls.test.tsx
Normal file
@ -0,0 +1,20 @@
|
||||
import React from 'react';
|
||||
import { render } from '../../../tests/utils';
|
||||
|
||||
import Base from '../Base';
|
||||
|
||||
describe('Typography keep prefixCls', () => {
|
||||
describe('Base', () => {
|
||||
it('should support className when has prefix', () => {
|
||||
const { container: wrapper } = render(
|
||||
<Base component="p" prefixCls="custom-prefixCls" className="custom-class">
|
||||
test prefixCls
|
||||
</Base>,
|
||||
);
|
||||
expect(
|
||||
(wrapper.firstChild as HTMLElement)?.className.includes('custom-prefixCls'),
|
||||
).toBeTruthy();
|
||||
expect((wrapper.firstChild as HTMLElement)?.className.includes('custom-class')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user