Skip to content

Commit

Permalink
Merge pull request #176 from actiontech/feature_test_order
Browse files Browse the repository at this point in the history
[test](sqle/Order): unit test list & create
  • Loading branch information
LZS911 authored Jan 16, 2024
2 parents 8fe3347 + 82f5af7 commit 36d6522
Show file tree
Hide file tree
Showing 85 changed files with 64,732 additions and 233 deletions.
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

0 comments on commit 36d6522

Please sign in to comment.