Skip to content

Commit

Permalink
fix: 修改 lint 问题
Browse files Browse the repository at this point in the history
  • Loading branch information
visiky committed Aug 4, 2021
1 parent 25a74d0 commit 91d33aa
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
12 changes: 6 additions & 6 deletions __tests__/bugs/issue-2755-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('sankey', () => {

const dom = createDiv();
const sankey = new Sankey(dom, {
data: data.map(d => ({ ...d, append: 'hello' })),
data: data.map((d) => ({ ...d, append: 'hello' })),
sourceField: 'source',
targetField: 'target',
weightField: 'value',
Expand All @@ -33,20 +33,20 @@ describe('sankey', () => {

sankey.render();

it('label', () => {
it('label', () => {
sankey.update({ label: { formatter: () => 'HELLO' } });
expect(sankey.chart.views[1].geometries[0].labelsContainer.getChildByIndex(0).cfg.children[0].attr('text')).toBe(
"HELLO"
'HELLO'
);
// with rawFields
sankey.update({ label: { formatter: ({ append }) => append } });
expect(sankey.chart.views[1].geometries[0].labelsContainer.getChildByIndex(0).cfg.children[0].attr('text')).toBe(
"hello"
'hello'
);
});

afterAll(() => {
sankey.destroy();
removeDom(dom);
})
});
});
});
22 changes: 13 additions & 9 deletions src/plots/sankey/adaptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,20 @@ function defaultOptions(params: Params<SankeyOptions>): Params<SankeyOptions> {
const { options } = params;
const { rawFields = [] } = options;

return deepAssign({}, {
options: {
tooltip: {
fields: uniq(['name', 'source', 'target', 'value', 'isNode', ...rawFields]),
},
label: {
fields: uniq(['x', 'name', ...rawFields]),
return deepAssign(
{},
{
options: {
tooltip: {
fields: uniq(['name', 'source', 'target', 'value', 'isNode', ...rawFields]),
},
label: {
fields: uniq(['x', 'name', ...rawFields]),
},
},
}
}, params);
},
params
);
}

/**
Expand Down

0 comments on commit 91d33aa

Please sign in to comment.