diff --git a/components/popconfirm/__tests__/index.test.js b/components/popconfirm/__tests__/index.test.js index 15e28a48b4a1a6f8e07c4f3d0754e24e05685e9e..929c6d3e328db7c89adc5d837ea764ecc4e2265b 100644 --- a/components/popconfirm/__tests__/index.test.js +++ b/components/popconfirm/__tests__/index.test.js @@ -99,4 +99,22 @@ describe('Popconfirm', () => { triggerNode.simulate('click'); expect(wrapper.find('.customize-icon').length).toBe(1); }); + + it('should prefixCls correctly', () => { + const btnPrefixCls = 'custom-btn'; + const wrapper = mount( + + show me your code + + ); + + expect(wrapper.find('.custom-popconfirm').length).toBeGreaterThan(0); + expect(wrapper.find('.custom-btn').length).toBeGreaterThan(0); + }); }); diff --git a/components/popconfirm/index.tsx b/components/popconfirm/index.tsx index 502f8fef198b977c95b95f5961262149b19b9c52..d93c11111240e7166354ea8c01858c6a9364a4d0 100644 --- a/components/popconfirm/index.tsx +++ b/components/popconfirm/index.tsx @@ -3,7 +3,7 @@ import { polyfill } from 'react-lifecycles-compat'; import Tooltip, { AbstractTooltipProps } from '../tooltip'; import Icon from '../icon'; import Button from '../button'; -import { ButtonType } from '../button/button'; +import { ButtonType, NativeButtonProps } from '../button/button'; import LocaleReceiver from '../locale-provider/LocaleReceiver'; import defaultLocale from '../locale-provider/default'; @@ -14,6 +14,8 @@ export interface PopconfirmProps extends AbstractTooltipProps { okText?: React.ReactNode; okType?: ButtonType; cancelText?: React.ReactNode; + okButtonProps?: NativeButtonProps; + cancelButtonProps?: NativeButtonProps; icon?: React.ReactNode; onVisibleChange?: (visible?: boolean, e?: React.MouseEvent) => void; } @@ -97,7 +99,7 @@ class Popconfirm extends React.Component { } renderOverlay = (popconfirmLocale: PopconfirmLocale) => { - const { prefixCls, title, cancelText, okText, okType, icon } = this.props; + const { prefixCls, okButtonProps, cancelButtonProps, title, cancelText, okText, okType, icon } = this.props; return ( @@ -106,10 +108,10 @@ class Popconfirm extends React.Component { {title} - + {cancelText || popconfirmLocale.cancelText} - + {okText || popconfirmLocale.okText}