-
-
Notifications
You must be signed in to change notification settings - Fork 318
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
test: use unified github action yml #868
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Walkthrough此次更改涉及多个文件的结构和配置调整,包括简化GitHub Actions工作流、更新.gitignore文件以排除临时文件、引入bunfig.toml配置文件,以及在TypeScript示例文件中添加禁用类型检查的指令。此外,测试文件进行了重构,移除了某些键盘交互功能,并临时注释掉了相关类型声明。同时, Changes
Sequence Diagram(s)sequenceDiagram
participant CI as CI/CD Pipeline
participant Workflow as External Workflow
CI->>Workflow: Trigger test job
Workflow-->>CI: Execute tests
CI->>CI: Report results
在代码的世界里,兔子欢跳, Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (8)
- .github/workflows/main.yml (1 hunks)
- .gitignore (1 hunks)
- bunfig.toml (1 hunks)
- docs/examples/cellRender.tsx (1 hunks)
- docs/examples/customize.tsx (1 hunks)
- docs/examples/rtl.tsx (1 hunks)
- tests/keyboard.spec.tsx (2 hunks)
- tests/util/commonUtil.tsx (2 hunks)
Files skipped from review due to trivial changes (5)
- .github/workflows/main.yml
- .gitignore
- bunfig.toml
- docs/examples/cellRender.tsx
- docs/examples/customize.tsx
docs/examples/rtl.tsx
Outdated
@@ -1,3 +1,4 @@ | |||
// @ts-nocheck |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
谨慎使用 // @ts-nocheck
添加 // @ts-nocheck
会禁用整个文件的类型检查,这可能会隐藏潜在的类型错误。建议在解决类型问题后移除该指令。
tests/util/commonUtil.tsx
Outdated
// import type { PickerBaseProps, PickerDateProps, PickerTimeProps } from '../../src/Picker'; | ||
// import type { | ||
// PickerPanelBaseProps, | ||
// PickerPanelDateProps, | ||
// PickerPanelTimeProps, | ||
// } from '../../src/PickerPanel'; | ||
// import { | ||
// type RangePickerBaseProps, | ||
// type RangePickerDateProps, | ||
// type RangePickerTimeProps, | ||
// } from '../../src/RangePicker'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
谨慎注释类型导入
注释掉类型导入可能是为了重构或测试,但这会导致类型安全性丧失和潜在的运行时错误。建议在完成重构或测试后重新启用这些类型。
tests/util/commonUtil.tsx
Outdated
// interface MomentDefaultProps { | ||
// locale?: PickerProps<Moment>['locale']; | ||
// generateConfig?: PickerProps<Moment>['generateConfig']; | ||
// } | ||
|
||
type InjectDefaultProps<Props> = Omit<Props, 'locale' | 'generateConfig'> & MomentDefaultProps; | ||
// type InjectDefaultProps<Props> = Omit<Props, 'locale' | 'generateConfig'> & MomentDefaultProps; | ||
|
||
// Moment Picker | ||
export type MomentPickerProps = | ||
| InjectDefaultProps<PickerBaseProps<Moment>> | ||
| InjectDefaultProps<PickerDateProps<Moment>> | ||
| InjectDefaultProps<PickerTimeProps<Moment>>; | ||
|
||
// Moment Panel Picker | ||
export type MomentPickerPanelProps = | ||
| InjectDefaultProps<PickerPanelBaseProps<Moment>> | ||
| InjectDefaultProps<PickerPanelDateProps<Moment>> | ||
| InjectDefaultProps<PickerPanelTimeProps<Moment>>; | ||
|
||
// Moment Range Picker | ||
export type MomentRangePickerProps = | ||
| InjectDefaultProps<RangePickerBaseProps<Moment>> | ||
| InjectDefaultProps<RangePickerDateProps<Moment>> | ||
| InjectDefaultProps<RangePickerTimeProps<Moment>>; | ||
// export type MomentPickerProps = | ||
// | InjectDefaultProps<PickerBaseProps<Moment>> | ||
// | InjectDefaultProps<PickerDateProps<Moment>> | ||
// | InjectDefaultProps<PickerTimeProps<Moment>>; | ||
|
||
// // Moment Panel Picker | ||
// export type MomentPickerPanelProps = | ||
// | InjectDefaultProps<PickerPanelBaseProps<Moment>> | ||
// | InjectDefaultProps<PickerPanelDateProps<Moment>> | ||
// | InjectDefaultProps<PickerPanelTimeProps<Moment>>; | ||
|
||
// // Moment Range Picker | ||
// export type MomentRangePickerProps = | ||
// | InjectDefaultProps<RangePickerBaseProps<Moment>> | ||
// | InjectDefaultProps<RangePickerDateProps<Moment>> | ||
// | InjectDefaultProps<RangePickerTimeProps<Moment>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
谨慎注释类型接口和导出
注释掉类型接口和导出可能是为了重构或测试,但这会导致类型安全性丧失和潜在的运行时错误。建议在完成重构或测试后重新启用这些类型。
tests/keyboard.spec.tsx
Outdated
// function keyDown(keyCode: number, info?: object, index = 0) { | ||
// const input = document.querySelectorAll('input')[index]; | ||
// const event = createEvent.keyDown(input, { | ||
// keyCode, | ||
// which: keyCode, | ||
// charCode: keyCode, | ||
// ...info, | ||
// }); | ||
|
||
// fireEvent(input, event); | ||
|
||
// return event; | ||
// } | ||
|
||
// function panelKeyDown(keyCode: number, info?: object) { | ||
// fireEvent.keyDown(document.querySelector('.rc-picker-panel') as HTMLElement, { | ||
// keyCode, | ||
// which: keyCode, | ||
// charCode: keyCode, | ||
// ...info, | ||
// }); | ||
// document.querySelector('.rc-picker-panel').simulate('keyDown', { which: keyCode, ...info }); | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
谨慎注释键盘交互函数
注释掉键盘交互函数可能是为了重构或测试,但这会导致测试覆盖率丧失和潜在的问题未被检测到。建议在完成重构或测试后重新启用这些函数。
tests/keyboard.spec.tsx
Outdated
// keyDown(KeyCode.ESC); | ||
// expect(container.querySelector('input').value).toEqual(''); | ||
// }); | ||
|
||
// it('move based on current date on first keyboard event', () => { | ||
// const onCalendarChange = jest.fn(); | ||
// const onChange = jest.fn(); | ||
// const { container } = render( | ||
// <DayRangePicker onCalendarChange={onCalendarChange} onChange={onChange} />, | ||
// ); | ||
|
||
// // Start Date | ||
// openPicker(container); | ||
// // wrapper | ||
// // .find('input') | ||
// // .first() | ||
// // .simulate('change', { target: { value: '' } }); | ||
// fireEvent.change(container.querySelector('input'), { target: { value: '' } }); | ||
// keyDown(KeyCode.TAB); | ||
// keyDown(KeyCode.RIGHT); | ||
// keyDown(KeyCode.ENTER); | ||
// expect(onCalendarChange.mock.calls[0][1]).toEqual(['1990-09-04', '']); | ||
// expect(onChange).not.toHaveBeenCalled(); | ||
// }); | ||
// }); | ||
|
||
// it('enter should prevent default to avoid form submit', () => { | ||
// render(<DayPicker />); | ||
// const event = keyDown(KeyCode.ENTER); | ||
|
||
// expect(event.defaultPrevented).toBeTruthy(); | ||
// }); | ||
|
||
// describe('keyboard should not trigger on disabledDate', () => { | ||
// it('picker', () => { | ||
// const onChange = jest.fn(); | ||
// const onSelect = jest.fn(); | ||
// const { container } = render( | ||
// <DayPicker | ||
// showTime | ||
// onSelect={onSelect} | ||
// onChange={onChange} | ||
// disabledDate={(date) => date.date() % 2 === 0} | ||
// />, | ||
// ); | ||
// // document.querySelector('input').simulate('focus'); | ||
// fireEvent.focus(container.querySelector('input')); | ||
// keyDown(KeyCode.ENTER); | ||
// keyDown(KeyCode.TAB); | ||
// keyDown(KeyCode.TAB); | ||
// keyDown(KeyCode.DOWN); | ||
// expect(isSame(onSelect.mock.calls[0][0], '1990-09-10')).toBeTruthy(); | ||
|
||
// // Not enter to change | ||
// keyDown(KeyCode.ENTER); | ||
// expect(onChange).not.toHaveBeenCalled(); | ||
|
||
// // Not button enabled | ||
// expect( | ||
// document.querySelector<HTMLButtonElement>('.rc-picker-ok button').disabled, | ||
// ).toBeTruthy(); | ||
|
||
// // Another can be enter | ||
// keyDown(KeyCode.RIGHT); | ||
// expect( | ||
// document.querySelector<HTMLButtonElement>('.rc-picker-ok button').disabled, | ||
// ).toBeFalsy(); | ||
// keyDown(KeyCode.ENTER); | ||
// expect(onChange).toHaveBeenCalled(); | ||
// }); | ||
|
||
// it('panel', () => { | ||
// const onChange = jest.fn(); | ||
// const onSelect = jest.fn(); | ||
// render( | ||
// <DayPickerPanel | ||
// onSelect={onSelect} | ||
// onChange={onChange} | ||
// disabledDate={(date) => date.date() % 2 === 0} | ||
// />, | ||
// ); | ||
|
||
// fireEvent.focus(document.querySelector('.rc-picker-panel')); | ||
// // 9-02、9-04、9-10 is disabled | ||
// panelKeyDown(KeyCode.LEFT); | ||
// panelKeyDown(KeyCode.RIGHT); | ||
// panelKeyDown(KeyCode.DOWN); | ||
// expect(onSelect).not.toHaveBeenCalled(); | ||
|
||
// // 7-27、8-27 is enabled | ||
// panelKeyDown(KeyCode.UP); | ||
// expect(isSame(onSelect.mock.calls[0][0], '1990-08-27')).toBeTruthy(); | ||
// onSelect.mockReset(); | ||
// panelKeyDown(KeyCode.PAGE_UP); | ||
// expect(isSame(onSelect.mock.calls[0][0], '1990-07-27')).toBeTruthy(); | ||
// onSelect.mockReset(); | ||
// panelKeyDown(KeyCode.PAGE_DOWN); | ||
// expect(isSame(onSelect.mock.calls[0][0], '1990-08-27')).toBeTruthy(); | ||
// }); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
谨慎注释测试用例
注释掉测试用例可能是为了重构或测试,但这会导致测试覆盖率丧失和潜在的问题未被检测到。建议在完成重构或测试后重新启用这些测试用例。
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #868 +/- ##
=======================================
Coverage 95.42% 95.42%
=======================================
Files 64 64
Lines 2711 2711
Branches 758 731 -27
=======================================
Hits 2587 2587
Misses 121 121
Partials 3 3 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- docs/examples/cellRender.tsx (2 hunks)
Additional comments not posted (2)
docs/examples/cellRender.tsx (2)
153-156
: 更改参数类型以提高灵活性将
current
参数的类型从Moment
更改为number | string
提高了函数的灵活性。渲染逻辑也正确处理了新的类型。代码更改已批准。
176-182
: 更改参数类型以提高灵活性将
current
参数的类型从Moment
更改为更通用的类型提高了函数的灵活性。渲染逻辑也正确处理了新的类型。代码更改已批准。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- docs/examples/rtl.tsx (3 hunks)
Additional comments not posted (4)
docs/examples/rtl.tsx (4)
4-4
: 导入类型检查通过新导入的类型
PickerRef
、RangePickerRef
和NoUndefinedRangeValueType
是为了更新文件中的类型引用,符合预期。这些导入更改是合理的。
Also applies to: 10-11
22-22
: 类型更新通过
weekRef
现在的类型是PickerRef
而不是Picker<Moment>
,这使得引用类型与其预期用途保持一致。类型更新是合理的。
28-31
: 函数签名更新通过
onChange
函数签名更新为接受类型为NoUndefinedRangeValueType<Moment>
的newValue
和类型为string | [string, string]
的formatString
,这引入了更具体的类型约束,改进了范围值的处理,并允许更大的格式选项灵活性。函数签名更新是合理的。
45-45
: 类型更新通过
rangePickerRef
现在的类型是RangePickerRef
而不是RangePicker<Moment>
,这确保了组件中类型使用的一致性。类型更新是合理的。
tests/util/commonUtil.tsx
Outdated
// export type MomentRangePickerProps = | ||
// | InjectDefaultProps<RangePickerBaseProps<Moment>> | ||
// | InjectDefaultProps<RangePickerDateProps<Moment>> | ||
// | InjectDefaultProps<RangePickerTimeProps<Moment>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这是干啥。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Picker 似乎改版过, 这些是旧的类型定义. 没有用到, 并且部分类型已经不存在了.
测试用例部分是直接 return 了的, 我看很多逻辑是没完全调整完.
直接删掉不知道会不会影响后续重构, 就先注释没删掉.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
没有用就直接删掉吧。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
直接删了吧
no-check 部分已做处理 @zombieJ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- docs/examples/customize.tsx (4 hunks)
Files skipped from review as they are similar to previous changes (1)
- docs/examples/customize.tsx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range, codebase verification and nitpick comments (1)
tests/keyboard.spec.tsx (1)
Line range hint
1-111
: 谨慎注释键盘交互函数和测试用例注释掉键盘交互函数和测试用例可能是为了重构或测试,但这会导致测试覆盖率丧失和潜在的问题未被检测到。建议在完成重构或测试后重新启用这些函数和测试用例。
请确保在重构完成后重新启用或替换这些注释掉的测试用例。
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- docs/examples/customize.tsx (3 hunks)
- tests/keyboard.spec.tsx (2 hunks)
- tests/util/commonUtil.tsx (3 hunks)
Files skipped from review as they are similar to previous changes (1)
- tests/util/commonUtil.tsx
Additional comments not posted (3)
tests/keyboard.spec.tsx (2)
4-4
: 导入语句正确导入语句是正确的,并且是测试所必需的。
代码更改已批准。
107-111
: 测试用例正确测试用例正确地实现了对部分日期输入的检查。
代码更改已批准。
docs/examples/customize.tsx (1)
104-104
: 代码简化和重构删除了
initValue
状态变量,并简化了 JSX 结构,表明这是一次旨在减少复杂性和提高可维护性的重构。代码更改已批准。
ant-design/ant-design#50461
Summary by CodeRabbit
新功能
bunfig.toml
配置文件,允许用户自定义依赖安装选项。改进
.gitignore
文件中添加了临时文件和锁文件的忽略规则,改善了项目整洁性。cellRender
函数的类型注解,增强了函数的灵活性。rtl
组件的类型引用和函数签名,提高了类型安全性和清晰度。customize
组件中的面板变更回调函数类型,增强了类型安全性,并调整了当前日期显示方式。测试