Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 明细表表头宽度拖拽条位置出错 bug close #2588 #2593

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

wangjinqing111
Copy link

@wangjinqing111 wangjinqing111 commented Mar 12, 2024

👀 PR includes

✨ Feature

  • New feature

🎨 Enhance

  • Code style optimization
  • Refactoring
  • Change the UI
  • Improve the performance
  • Type optimization

🐛 Bugfix

🔧 Chore

  • Test case
  • Docs / demos update
  • CI / workflow
  • Release version
  • Other ()

📝 Description

🖼️ Screenshot

Before After

🔗 Related issue link

🔍 Self-Check before the merge

  • Add or update relevant docs.
  • Add or update relevant demos.
  • Add or update test case.
  • Add or update relevant TypeScript definitions.

Copy link

vercel bot commented Mar 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
antvis-s2 ❌ Failed (Inspect) Mar 13, 2024 8:56am

@wangjinqing111
Copy link
Author

ScreenShot Before:
image

ScreenShot After:
image

@lijinke666 lijinke666 added the 🙏 need test cases or docs 需要单元测试或者补充文档 label Mar 12, 2024
Copy link
Contributor

你好 @wangjinqing111,感谢你的贡献, 为了让代码更健壮, 请补充相应单元测试, 如果有 API 改动, 请修改 相应的文档

Hello, @wangjinqing111, Thanks for your contribution. In order to make the code more robust, please add the corresponding unit tests, and update the docs if there are API changes.

@lijinke666
Copy link
Member

感谢贡献, 请增加相应的单测,可以写在 packages/s2-core/tests/spreadsheet/table-resize-spec.ts 这里面, 断言一下热区的坐标

调试可以参考: https://s2.antv.antgroup.com/manual/contribution#%E8%B0%83%E8%AF%95%E5%8D%95%E6%B5%8B

@wangjinqing111
Copy link
Author

已经补充了相应的单元测试,写的不太好,辛苦大佬多多帮忙review下,有个小问题请教一下:
我在项目根目录下运行 单测命令,出现下图错误:
image

然而我在packages/s2-core目录下运行 单测命令是可以成功的,不知道是什么原因;
image

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 50.00000% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 77.62%. Comparing base (1adc25d) to head (d0e89fa).
Report is 137 commits behind head on master.

Files Patch % Lines
packages/s2-core/src/cell/table-col-cell.ts 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2593      +/-   ##
==========================================
+ Coverage   76.48%   77.62%   +1.14%     
==========================================
  Files         240      249       +9     
  Lines       12312    11992     -320     
  Branches     2630     2364     -266     
==========================================
- Hits         9417     9309     -108     
+ Misses       1377     1183     -194     
+ Partials     1518     1500      -18     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -34,4 +38,72 @@ describe('Table Sheet Resize Test', () => {

expect(resizeGroup.getChildren().length).toBeGreaterThan(0);
});

test('is the size area located correctly in col cell When freezing the first column', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

两个单测基本相同, 看起来只有 frozenColCountfrozenTrailingColCount 区别, 可以使用 test.each 避免编写重复代码. 参考:

test.each([S2Event.ROW_CELL_CLICK, S2Event.COL_CELL_CLICK])(
'should selected cell when %s cell clicked',
(event) => {
const selected = jest.fn();
s2.on(S2Event.GLOBAL_SELECTED, selected);
const isSelectedCellSpy = jest
.spyOn(s2.interaction, 'isSelectedCell')
.mockImplementation(() => false);
s2.emit(event, {
stopPropagation() {},
} as unknown as GEvent);
expect(s2.interaction.getState()).toEqual({
cells: [mockCellMeta],
nodes: [],
stateName: InteractionStateName.SELECTED,
});
expect(s2.showTooltipWithInfo).toHaveBeenCalled();
expect(selected).toHaveBeenCalled();
expect(s2.interaction.hasIntercepts([InterceptType.HOVER])).toBeTrue();
isSelectedCellSpy.mockRestore();
},
);

s2.destroy();
});

test('is the size area located correctly in col cell When freezing the last column', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When => when ?

@@ -45,7 +45,11 @@ export class TableColCell extends ColCell {
return isTopLevelNode(node);
},
);
const { colIndex } = getNodeRoot(this.meta);
// const { colIndex } = getNodeRoot(this.meta);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

注释去掉

@lijinke666
Copy link
Member

lijinke666 commented Mar 14, 2024

我在项目根目录下运行 单测命令,出现下图错误:

你的截图看起来是 Windows, 这个是设置环境变量 DEBUG_MODE=1 的方式不兼容 Windows , Windows 环境应该是 set DEBUG_MODE=1, 你感兴趣的话可以一起修了, 使用一个跨平台的包来解决, 比如使用 https://github.com/kentcdodds/cross-env#usage

execSync(`DEBUG_MODE=1 npx jest ${selectedPath.path}`);

@lijinke666 lijinke666 removed the 🙏 need test cases or docs 需要单元测试或者补充文档 label Mar 14, 2024
@lijinke666
Copy link
Member

ping @wangjinqing111

@lijinke666
Copy link
Member

我在项目根目录下运行 单测命令,出现下图错误:

你的截图看起来是 Windows, 这个是设置环境变量 DEBUG_MODE=1 的方式不兼容 Windows , Windows 环境应该是 set DEBUG_MODE=1, 你感兴趣的话可以一起修了, 使用一个跨平台的包来解决, 比如使用 https://github.com/kentcdodds/cross-env#usage

execSync(`DEBUG_MODE=1 npx jest ${selectedPath.path}`);

这个问题单独修复 #2600

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr(fix) bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛明细表格-多层表头加列冻结情况下-表头宽度拖拽条位置出错
3 participants