From b7d1c5661b51791bf991b621efe760f57a3da974 Mon Sep 17 00:00:00 2001 From: wjgogogo <906626481@qq.com> Date: Mon, 6 May 2024 15:01:17 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E5=8D=95=E6=B5=8B=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../interaction-brush-selection-scroll-spec.ts | 2 +- .../s2-core/__tests__/spreadsheet/table-sheet-spec.ts | 10 +++++----- packages/s2-core/__tests__/unit/utils/text-spec.ts | 4 +--- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/s2-core/__tests__/spreadsheet/interaction-brush-selection-scroll-spec.ts b/packages/s2-core/__tests__/spreadsheet/interaction-brush-selection-scroll-spec.ts index e3fae89f97..1d82dea539 100644 --- a/packages/s2-core/__tests__/spreadsheet/interaction-brush-selection-scroll-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/interaction-brush-selection-scroll-spec.ts @@ -129,7 +129,7 @@ const expectScrollBrush = async ( s2.on(S2Event.DATA_CELL_BRUSH_SELECTION, dataCellBrushSelectionFn); // g5.0 异步渲染,第一时刻底层 base-brush 可能无法通过 elementsFromPointSync 取到元素 - await sleep(50); + await sleep(500); s2.emit(mouseDownEventType, { target: targetCell, diff --git a/packages/s2-core/__tests__/spreadsheet/table-sheet-spec.ts b/packages/s2-core/__tests__/spreadsheet/table-sheet-spec.ts index c02d327c1b..de9ea37e52 100644 --- a/packages/s2-core/__tests__/spreadsheet/table-sheet-spec.ts +++ b/packages/s2-core/__tests__/spreadsheet/table-sheet-spec.ts @@ -194,7 +194,7 @@ describe('TableSheet normal spec', () => { await s2.render(); - await sleep(30); + await sleep(100); let columnNodes = s2.facet.getColNodes(); @@ -203,8 +203,8 @@ describe('TableSheet normal spec', () => { s2.getCanvasElement().dispatchEvent( new PointerEvent('pointerdown', { - clientX: x + width - 0.4, - clientY: top + 25, + clientX: x + width, + clientY: top, pointerType: 'mouse', }), ); @@ -216,7 +216,7 @@ describe('TableSheet normal spec', () => { document.dispatchEvent( new PointerEvent('pointermove', { clientX: x + width + resizeLength, - clientY: top + 25, + clientY: top, bubbles: true, }), ); @@ -225,7 +225,7 @@ describe('TableSheet normal spec', () => { document.dispatchEvent( new PointerEvent('pointerup', { clientX: x + width + resizeLength, - clientY: top + 25, + clientY: top, bubbles: true, }), ); diff --git a/packages/s2-core/__tests__/unit/utils/text-spec.ts b/packages/s2-core/__tests__/unit/utils/text-spec.ts index 063c5f0b47..a737d05e8c 100644 --- a/packages/s2-core/__tests__/unit/utils/text-spec.ts +++ b/packages/s2-core/__tests__/unit/utils/text-spec.ts @@ -11,8 +11,6 @@ import { isUnchangedValue, } from '@/utils/text'; -const isHD = window.devicePixelRatio >= 2; - describe('Text Utils Tests', () => { const font: TextTheme = { fontFamily: 'Roboto', @@ -37,7 +35,7 @@ describe('Text Utils Tests', () => { test('should get correct text width', () => { const width = measureTextWidth('test', font); - expect(Math.floor(width)).toEqual(isHD ? 21 : 16); + expect(Math.floor(width)).toEqual(21); }); });