Skip to content
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

[test](sqle/Order): unit test list & create #176

Merged
merged 25 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ exports[`lib/BasicChart render type is column 1`] = `
class="ant-card-body"
>
<div
data="[{\\"x\\":1}]"
locale="zh-cn"
theme="dark"
data-custom-params="{\\"data\\":[{\\"x\\":1}],\\"theme\\":\\"dark\\",\\"locale\\":\\"zh-cn\\"}"
/>
</div>
</div>
Expand Down Expand Up @@ -238,8 +236,7 @@ exports[`lib/BasicChart render type is line 4`] = `
class="ant-card-body"
>
<div
data="[{\\"x\\":1}]"
theme="dark"
data-custom-params="{\\"data\\":[{\\"x\\":1}],\\"theme\\":\\"dark\\"}"
/>
</div>
</div>
Expand Down
22 changes: 5 additions & 17 deletions packages/shared/lib/testUtil/mockAntDesignPlots.jsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
import { cloneDeep, isObject } from 'lodash';

// 不适合作为 html 属性元素出现的 key 的数据集合
const customDomKeyData = ['label', 'legend'];
import { cloneDeep } from 'lodash';

const MockPlots = (props) => {
const { onReady, ref, ...othersParams } = cloneDeep(props);

Object.keys(othersParams).forEach((key) => {
if (customDomKeyData.includes(key)) {
delete othersParams[key];
return;
}
if (isObject(othersParams[key])) {
othersParams[key] = JSON.stringify(othersParams[key]);
}
});

return <div {...othersParams} />;
const clonePropsData = cloneDeep(props);
// 考虑到输入的属性是作为 div 的自定义属性,故而对 params 做了 stringify 的处理
const params = JSON.stringify(clonePropsData);
return <div data-custom-params={params} />;
};

const Line = MockPlots;
Expand Down
Loading
Loading