diff --git a/packages/s2-core/__tests__/bugs/issue-2385-spec.ts b/packages/s2-core/__tests__/bugs/issue-2385-spec.ts index 4e3e56430a..e505f19e88 100644 --- a/packages/s2-core/__tests__/bugs/issue-2385-spec.ts +++ b/packages/s2-core/__tests__/bugs/issue-2385-spec.ts @@ -16,6 +16,7 @@ const s2Options: S2Options = { }, layoutWidthType: 'compact', }, + showDefaultHeaderActionIcon: true, }; describe('Compare Layout Tests', () => { @@ -31,6 +32,15 @@ describe('Compare Layout Tests', () => { s2.render(); const colLeafNodes = s2.facet.layoutResult.colLeafNodes; + + const measureCell = s2.panelGroup.cfg.children[0].cfg.children[8]; + const cellStyle = measureCell.getStyle() || measureCell.theme.dataCell; + const { + padding: { left = 0, right = 0 }, + } = cellStyle?.cell; + expect(measureCell.getMaxTextWidth()).toEqual( + colLeafNodes[2].width - left - right, + ); expect(Math.floor(colLeafNodes[0].width)).toBeCloseTo(179); expect(Math.floor(colLeafNodes[1].width)).toEqual(98); }); diff --git a/packages/s2-core/__tests__/data/data-issue-2385.json b/packages/s2-core/__tests__/data/data-issue-2385.json index d6f20caac5..0ffdc09c87 100644 --- a/packages/s2-core/__tests__/data/data-issue-2385.json +++ b/packages/s2-core/__tests__/data/data-issue-2385.json @@ -127,6 +127,34 @@ "province": "吉林", "price": "3", "cost": "1.5" + }, + { + "type": "圆规", + "province": "浙江", + "city": "杭州", + "price": "111", + "cost": "1.5" + }, + { + "type": "圆规", + "province": "浙江", + "city": "舟山", + "price": "111", + "cost": "1.5" + }, + { + "type": "圆规", + "province": "吉林", + "city": "长春", + "price": "11122", + "cost": "1.5" + }, + { + "type": "圆规", + "province": "吉林", + "city": "白山", + "price": "111", + "cost": "1.5" } ], "fields": {