Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wanjj_1210
ant-design
提交
057c8a3e
A
ant-design
项目概览
wanjj_1210
/
ant-design
与 Fork 源项目一致
从无法访问的项目Fork
通知
10
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
ant-design
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
057c8a3e
编写于
10月 19, 2018
作者:
concefly
提交者:
Wei Zhu
10月 19, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: prefixCls dosen't pass to Popconfirm's Button (#12677)
上级
68763b18
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
24 addition
and
4 deletion
+24
-4
components/popconfirm/__tests__/index.test.js
components/popconfirm/__tests__/index.test.js
+18
-0
components/popconfirm/index.tsx
components/popconfirm/index.tsx
+6
-4
未找到文件。
components/popconfirm/__tests__/index.test.js
浏览文件 @
057c8a3e
...
...
@@ -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
(
<
Popconfirm
visible
title
=
"
x
"
prefixCls
=
"
custom-popconfirm
"
okButtonProps
=
{{
prefixCls
:
btnPrefixCls
}}
cancelButtonProps
=
{{
prefixCls
:
btnPrefixCls
}}
>
<
span
>
show
me
your
code
<
/span
>
<
/Popconfirm
>
);
expect
(
wrapper
.
find
(
'
.custom-popconfirm
'
).
length
).
toBeGreaterThan
(
0
);
expect
(
wrapper
.
find
(
'
.custom-btn
'
).
length
).
toBeGreaterThan
(
0
);
});
});
components/popconfirm/index.tsx
浏览文件 @
057c8a3e
...
...
@@ -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
<
any
>
)
=>
void
;
}
...
...
@@ -97,7 +99,7 @@ class Popconfirm extends React.Component<PopconfirmProps, PopconfirmState> {
}
renderOverlay
=
(
popconfirmLocale
:
PopconfirmLocale
)
=>
{
const
{
prefixCls
,
title
,
cancelText
,
okText
,
okType
,
icon
}
=
this
.
props
;
const
{
prefixCls
,
okButtonProps
,
cancelButtonProps
,
title
,
cancelText
,
okText
,
okType
,
icon
}
=
this
.
props
;
return
(
<
div
>
<
div
className
=
{
`
${
prefixCls
}
-inner-content`
}
>
...
...
@@ -106,10 +108,10 @@ class Popconfirm extends React.Component<PopconfirmProps, PopconfirmState> {
<
div
className
=
{
`
${
prefixCls
}
-message-title`
}
>
{
title
}
</
div
>
</
div
>
<
div
className
=
{
`
${
prefixCls
}
-buttons`
}
>
<
Button
onClick
=
{
this
.
onCancel
}
size
=
"small"
>
<
Button
onClick
=
{
this
.
onCancel
}
size
=
"small"
{
...
cancelButtonProps
}
>
{
cancelText
||
popconfirmLocale
.
cancelText
}
</
Button
>
<
Button
onClick
=
{
this
.
onConfirm
}
type
=
{
okType
}
size
=
"small"
>
<
Button
onClick
=
{
this
.
onConfirm
}
type
=
{
okType
}
size
=
"small"
{
...
okButtonProps
}
>
{
okText
||
popconfirmLocale
.
okText
}
</
Button
>
</
div
>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录