Skip to content

Commit b12e1e7

Browse files
committed
test: 修复测试
1 parent 9cfd72d commit b12e1e7

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

packages/s2-core/__tests__/spreadsheet/interaction-tooltip-spec.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,19 @@ describe('Interaction Tooltip Tests', () => {
3030
});
3131

3232
test('should display tooltip when data cell clicked', () => {
33-
const showTooltipWithInfoSpy = jest
34-
.spyOn(s2, 'showTooltipWithInfo')
35-
.mockImplementation(() => {});
33+
const isContains = () => {
34+
return s2.tooltip.container?.classList?.contains(
35+
'antv-s2-tooltip-container-show',
36+
);
37+
};
38+
39+
expect(isContains()).toBeFalsy();
3640

3741
s2.emit(S2Event.DATA_CELL_CLICK, {
3842
stopPropagation() {},
3943
} as unknown as GEvent);
4044

41-
expect(showTooltipWithInfoSpy).toHaveBeenCalledTimes(1);
45+
expect(isContains()).toBeTruthy();
4246
expect(s2.tooltip.container.style.display).not.toEqual('none');
4347
expect(s2.tooltip.container.style.visibility).not.toEqual('hidden');
4448
});

0 commit comments

Comments
 (0)