Skip to content

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

Merged
merged 1 commit into from
Jul 19, 2021
Merged

feat: support data-* #259

merged 1 commit into from
Jul 19, 2021

Conversation

yizhiyuyou
Copy link
Contributor

@yizhiyuyou yizhiyuyou commented May 8, 2021

通过 cypress 编写测试。页面中存在多个 Drawer 时,通过传递不同的 data-test-id 属性给对应 Drawer 组件,然后通过 data-test-id 可以准确获得对应的 DOM 元素。但是 Modal 组件将 data-test-id 给丢弃了。并没有在 DOM 元素上设置。从而造成不能准确地获取对应的 DOM 元素。

fix ant-design/ant-design#30716

@vercel
Copy link

vercel bot commented May 8, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/react-component/dialog/EsZbaPFm5tDAmi3b66WoLZLg3gNK
✅ Preview: https://dialog-git-fork-yizhiyuyou-master-react-component.vercel.app

@codecov
Copy link

codecov bot commented May 8, 2021

Codecov Report

Merging #259 (523163a) into master (cb6f8f0) will not change coverage.
The diff coverage is n/a.

❗ Current head 523163a differs from pull request most recent head 87a69b0. Consider uploading reports for the commit 87a69b0 to get more accurate results
Impacted file tree graph

@@           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           
Impacted Files Coverage Δ
src/Dialog/index.tsx 100.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cb6f8f0...87a69b0. Read the comment docs.

Copy link
Member

@shaodahong shaodahong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shaodahong shaodahong requested a review from zombieJ May 31, 2021 12:22
@areyouse7en
Copy link

LGTM

@yoyo837
Copy link
Member

yoyo837 commented Jun 4, 2021

再来个用例吧

@@ -162,7 +163,7 @@ export default function Dialog(props: IDialogChildProps) {

// ========================= Render =========================
return (
<div className={`${prefixCls}-root`}>
<div className={`${prefixCls}-root`} {...pickAttrs(props, { data: true })}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为啥不aria、data、attr都支持了?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

因为我之前只用到了 data。现在看来也可以同时支持 aria, attr。

@afc163 afc163 merged commit 370cb6b into react-component:master Jul 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Data attributes (e.g. data-testid) is not supported in Modal
5 participants