Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .dumirc.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import { defineConfig } from 'dumi';
import path from 'path';

const basePath = process.env.GH_PAGES ? '/segmented/' : '/';
const publicPath = process.env.GH_PAGES ? '/segmented/' : '/';

export default defineConfig({
favicons: [
'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
],
favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'],
themeConfig: {
name: 'Segmented',
logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'
logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
},
outputPath: '.doc',
exportStatic: {},
base: basePath,
publicPath,
alias: {
'rc-segmented': path.resolve(__dirname, 'src/index.tsx'),
},
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"devDependencies": {
"@rc-component/father-plugin": "^2.0.1",
"@rc-component/np": "^1.0.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/jest-dom": "^6.9.1",
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

更新导入路径和测试设置配置以适配 v6 的破坏性变更

从 v5.16.5 升级到 v6.9.1 涉及多项破坏性变更需要处理:

  • v6.0.0 移除了 extend-expect 脚本,不能再直接在 setupFilesAfterEnv 中引用包名
  • TypeScript 类型定义加载机制已更改,需要创建独立的设置文件或使用明确的导入路径(如 @testing-library/jest-dom/jest@testing-library/jest-dom/jest-globals@testing-library/jest-dom/vitest
  • 需要验证项目的 Jest 配置和测试设置文件是否已相应调整
🤖 Prompt for AI Agents
In package.json around line 57, the dependency was updated to
"@testing-library/jest-dom": "^6.9.1" but v6 introduced breaking changes: remove
direct package name in setupFilesAfterEnv and adjust TypeScript/type loading.
Fix by creating/using an explicit test setup file (e.g., tests/setupTests.ts or
jest.setup.ts) that imports the correct v6 entry (one of
@testing-library/jest-dom/jest, @testing-library/jest-dom/jest-globals, or
@testing-library/jest-dom/vitest depending on test runner), update package.json
Jest configuration to reference that setup file in setupFilesAfterEnv (not the
package name), and ensure TypeScript config includes the setup file types or add
the appropriate types import so type definitions load correctly.

"@testing-library/react": "^14.2.1",
"@testing-library/user-event": "^14.5.2",
"@types/jest": "^29.2.4",
Expand Down
3 changes: 1 addition & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,6 @@ const InternalSegmentedOption: React.FC<{
<div
className={clsx(`${prefixCls}-item-label`, segmentedClassNames?.label)}
title={title}
role="radio"
aria-checked={checked}
style={styles?.label}
>
{label}
Expand Down Expand Up @@ -308,6 +306,7 @@ const Segmented = React.forwardRef<HTMLDivElement, SegmentedProps>(
role="radiogroup"
aria-label="segmented control"
tabIndex={disabled ? undefined : 0}
aria-orientation={vertical ? 'vertical' : 'horizontal'}
style={style}
{...divProps}
className={clsx(
Expand Down
Loading