Skip to content

Commit

Permalink
test: 单测修复
Browse files Browse the repository at this point in the history
  • Loading branch information
wjgogogo committed May 6, 2024
1 parent 43b9141 commit b7d1c56
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions packages/s2-core/__tests__/spreadsheet/table-sheet-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ describe('TableSheet normal spec', () => {

await s2.render();

await sleep(30);
await sleep(100);

let columnNodes = s2.facet.getColNodes();

Expand All @@ -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',
}),
);
Expand All @@ -216,7 +216,7 @@ describe('TableSheet normal spec', () => {
document.dispatchEvent(
new PointerEvent('pointermove', {
clientX: x + width + resizeLength,
clientY: top + 25,
clientY: top,
bubbles: true,
}),
);
Expand All @@ -225,7 +225,7 @@ describe('TableSheet normal spec', () => {
document.dispatchEvent(
new PointerEvent('pointerup', {
clientX: x + width + resizeLength,
clientY: top + 25,
clientY: top,
bubbles: true,
}),
);
Expand Down
4 changes: 1 addition & 3 deletions packages/s2-core/__tests__/unit/utils/text-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import {
isUnchangedValue,
} from '@/utils/text';

const isHD = window.devicePixelRatio >= 2;

describe('Text Utils Tests', () => {
const font: TextTheme = {
fontFamily: 'Roboto',
Expand All @@ -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);
});
});

Expand Down

0 comments on commit b7d1c56

Please sign in to comment.