-
-
Notifications
You must be signed in to change notification settings - Fork 196
feat: support data-* #259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support data-* #259
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/react-component/dialog/EsZbaPFm5tDAmi3b66WoLZLg3gNK |
Codecov Report
@@ Coverage Diff @@
## master #259 +/- ##
=======================================
Coverage 98.12% 98.12%
=======================================
Files 6 6
Lines 160 160
Branches 47 47
=======================================
Hits 157 157
Misses 2 2
Partials 1 1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
LGTM |
再来个用例吧 |
@@ -162,7 +163,7 @@ export default function Dialog(props: IDialogChildProps) { | |||
|
|||
// ========================= Render ========================= | |||
return ( | |||
<div className={`${prefixCls}-root`}> | |||
<div className={`${prefixCls}-root`} {...pickAttrs(props, { data: true })}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为啥不aria、data、attr都支持了?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
因为我之前只用到了 data。现在看来也可以同时支持 aria, attr。
通过 cypress 编写测试。页面中存在多个 Drawer 时,通过传递不同的 data-test-id 属性给对应 Drawer 组件,然后通过 data-test-id 可以准确获得对应的 DOM 元素。但是 Modal 组件将 data-test-id 给丢弃了。并没有在 DOM 元素上设置。从而造成不能准确地获取对应的 DOM 元素。
fix ant-design/ant-design#30716