Skip to content

Commit

Permalink
test: 修复单测
Browse files Browse the repository at this point in the history
  • Loading branch information
lijinke666 committed Feb 28, 2024
1 parent 3921d92 commit a1477ae
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 8 additions & 2 deletions packages/s2-core/src/utils/cell/cell.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { LineStyleProps } from '@antv/g';
import { isEmpty } from 'lodash';
import type { SimpleBBox } from '../../engine';
import {
CellClipBox,
Expand Down Expand Up @@ -199,6 +200,11 @@ export const getBorderPositionAndStyle = (
borderDash,
} = style;

// 如果是空数组 G 底层绘制会报错
const lineDash: LineStyleProps['lineDash'] = isEmpty(borderDash)
? ''
: borderDash;

const borderStyle: Partial<LineStyleProps> = [
CellBorderPosition.TOP,
CellBorderPosition.BOTTOM,
Expand All @@ -207,13 +213,13 @@ export const getBorderPositionAndStyle = (
lineWidth: horizontalBorderWidth,
stroke: horizontalBorderColor,
strokeOpacity: horizontalBorderColorOpacity,
lineDash: borderDash,
lineDash,
}
: {
lineWidth: verticalBorderWidth,
stroke: verticalBorderColor,
strokeOpacity: verticalBorderColorOpacity,
lineDash: borderDash,
lineDash,
};

let x1 = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ fetch(
displayCondition: (meta) => meta.rowIndex > 2,
onHover: (options) => {
const { meta, event } = options;
const div = document.createElement('div');
const content = document.createElement('div');

div.innerHTML = '我是 RowTooltip 自定义内容';
content.innerHTML = '我是 RowTooltip 自定义内容';

meta.spreadsheet.tooltip.show({
position: { x: event.clientX, y: event.clientY },
content: div,
content,
});
},
},
Expand Down

0 comments on commit a1477ae

Please sign in to comment.