Skip to content

Commit

Permalink
chore: 更新单测和快照
Browse files Browse the repository at this point in the history
  • Loading branch information
lijinke666 committed Dec 27, 2024
1 parent 13d3661 commit 97f52f2
Show file tree
Hide file tree
Showing 7 changed files with 177 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2271,12 +2271,12 @@ Array [
"width": 113.6,
},
Object {
"actualText": "2367236723611...",
"actualText": "236723672361111",
"actualTextHeight": 15,
"actualTextWidth": 96,
"actualTextWidth": 98,
"height": 30,
"multiLineActualTexts": Array [
"2367236723611...",
"236723672361111",
],
"originalText": 236723672361111,
"width": 113.6,
Expand Down Expand Up @@ -6356,8 +6356,8 @@ Array [
"actualTextWidth": 100,
"height": 30,
"multiLineActualTexts": Array [
"236723672361",
"111",
"2367236723611",
"11",
],
"originalText": 236723672361111,
"width": 102.57,
Expand Down Expand Up @@ -12254,8 +12254,8 @@ Array [
"actualTextWidth": 100,
"height": 30,
"multiLineActualTexts": Array [
"236723672361",
"111",
"2367236723611",
"11",
],
"originalText": 236723672361111,
"width": 102.57,
Expand Down Expand Up @@ -15261,8 +15261,8 @@ Array [
"actualTextWidth": 100,
"height": 30,
"multiLineActualTexts": Array [
"236723672361",
"111",
"2367236723611",
"11",
],
"originalText": 236723672361111,
"width": 102.57,
Expand Down
2 changes: 1 addition & 1 deletion packages/s2-core/__tests__/spreadsheet/scroll-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ describe('Scroll Tests', () => {
s2.changeSheetSize(1000, 150); // 纵向滚动条
await s2.render(false);

expect(Math.floor(s2.facet.vScrollBar.getBBox().x)).toEqual(213);
expect(Math.floor(s2.facet.vScrollBar.getBBox().x)).toEqual(201);

s2.setOptions({
interaction: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ describe('Col width Test', () => {
const colLeafNodes = s2.facet.getColLeafNodes();

// price 列,列头标签比表身数据更长
expect(Math.round(colLeafNodes[0].width)).toBe(52);
expect(Math.round(colLeafNodes[0].width)).toBe(47);
// cost 列,表身数据比列头更长(格式化)
expect(Math.round(colLeafNodes[1].width)).toBe(168);
});
Expand Down
6 changes: 3 additions & 3 deletions packages/s2-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@
},
"dependencies": {
"@antv/event-emitter": "^0.1.3",
"@antv/g": "^6.1.15",
"@antv/g-canvas": "^2.0.33",
"@antv/g-lite": "^2.2.10",
"@antv/g": "^6.1.17",
"@antv/g-canvas": "^2.0.35",
"@antv/g-lite": "^2.2.12",
"d3-ease": "^3.0.1",
"d3-interpolate": "^1.3.2",
"d3-timer": "^1.0.9",
Expand Down
3 changes: 2 additions & 1 deletion packages/s2-core/src/sheet-type/spread-sheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,8 @@ export abstract class SpreadSheet extends EE {
return null;
}

const ctx = getOffscreenCanvas()?.getContext('2d')!;
const canvas = getOffscreenCanvas() || this.getCanvasElement();
const ctx = canvas?.getContext('2d')!;
const { fontSize, fontFamily, fontWeight, fontStyle, fontVariant } =
font as CSSStyleDeclaration;

Expand Down
Loading

0 comments on commit 97f52f2

Please sign in to comment.