mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-09 02:49:18 +08:00
* fix(button): add theme-aware preset color hover/active tokens
Add ${colorKey}Hover and ${colorKey}Active tokens that swap values based on dark/light mode for improved contrast and user experience.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: add preset color hover/active tokens for consistent button interaction
- Add xxxHover and xxxActive tokens for preset colors in genColorMapToken
- Override these tokens in dark mode to swap hover/active values
- Update ButtonToken type to include PresetColorHoverActiveMap
- Update button variant styles to use new hover/active tokens
- Fix #56656: button hover/active state inconsistency in dark mode
* test: add @csstools to compileModules
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* test: support .mjs files in Jest configuration
- Updated .jest.js transform pattern to include .mjs files
- Simplified .jest.node.js transform patterns
- Added jest-mjs-transformer.js for babel-jest mjs handling
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* test: remove unused jest-mjs-transformer.js
- Removed jest-mjs-transformer.js as it's no longer used
- .mjs files are now handled by the updated transform patterns in Jest configs
* test: add .mjs support to .jest.image.js
- Updated .jest.image.js transform pattern to include .mjs files
- fixes image test failures due to ES module parsing errors
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
96 lines
2.8 KiB
JavaScript
96 lines
2.8 KiB
JavaScript
const compileModules = [
|
|
'react-sticky-box',
|
|
'rc-tween-one',
|
|
'@babel',
|
|
'@ant-design',
|
|
'countup.js',
|
|
'.pnpm',
|
|
'@asamuzakjp/css-color',
|
|
'@rc-component',
|
|
// jsdom 27+ depends on ESM parse5, need transform
|
|
'parse5',
|
|
'@exodus',
|
|
'jsdom',
|
|
'@csstools',
|
|
];
|
|
|
|
// cnpm use `_` as prefix
|
|
const ignoreList = ['', '_'].reduce(
|
|
(acc, prefix) => [...acc, ...compileModules.map((module) => `${prefix}${module}`)],
|
|
[],
|
|
);
|
|
|
|
const transformIgnorePatterns = [
|
|
// Ignore modules without es dir.
|
|
// Update: @babel/runtime should also be transformed
|
|
`[/\\\\]node_modules[/\\\\](?!${ignoreList.join('|')})[^/\\\\]+?[/\\\\](?!(es)[/\\\\])`,
|
|
// Ignore antd umd js file
|
|
'[/\\\\]dist[/\\\\]antd.*\\.js$',
|
|
];
|
|
|
|
function getTestRegex(libDir) {
|
|
if (['dist', 'lib', 'es', 'dist-min'].includes(libDir)) {
|
|
return 'demo\\.test\\.(j|t)sx?$';
|
|
}
|
|
return '.*\\.test\\.(j|t)sx?$';
|
|
}
|
|
|
|
const shouldIgnoreSemantic =
|
|
['dist', 'lib', 'es', 'dist-min'].includes(process.env.LIB_DIR) ||
|
|
['1', 'true'].includes(process.env.SKIP_SEMANTIC);
|
|
|
|
module.exports = {
|
|
verbose: true,
|
|
testEnvironment: 'jsdom',
|
|
setupFiles: ['./tests/setup.ts', 'jest-canvas-mock'],
|
|
setupFilesAfterEnv: ['./tests/setupAfterEnv.ts'],
|
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'md'],
|
|
modulePathIgnorePatterns: ['/_site/'],
|
|
moduleNameMapper: {
|
|
'/\\.(css|less)$/': 'identity-obj-proxy',
|
|
'^antd$': '<rootDir>/components/index',
|
|
'^antd/es/(.*)$': '<rootDir>/components/$1',
|
|
'^antd/lib/(.*)$': '<rootDir>/components/$1',
|
|
'^antd/locale/(.*)$': '<rootDir>/components/locale/$1',
|
|
},
|
|
testPathIgnorePatterns: [
|
|
'/node_modules/',
|
|
'dekko',
|
|
'node',
|
|
'image.test.js',
|
|
'image.test.ts',
|
|
...(shouldIgnoreSemantic ? ['demo-semantic.test'] : []),
|
|
],
|
|
transform: {
|
|
'\\.tsx?$': './node_modules/@ant-design/tools/lib/jest/codePreprocessor',
|
|
'\\.(m?)js(m)?$': './node_modules/@ant-design/tools/lib/jest/codePreprocessor',
|
|
'\\.md$': './node_modules/@ant-design/tools/lib/jest/demoPreprocessor',
|
|
'\\.(jpg|png|gif|svg)$': './node_modules/@ant-design/tools/lib/jest/imagePreprocessor',
|
|
},
|
|
testRegex: getTestRegex(process.env.LIB_DIR),
|
|
collectCoverageFrom: [
|
|
'components/**/*.{ts,tsx}',
|
|
'!components/*/style/index.tsx',
|
|
'!components/style/index.tsx',
|
|
'!components/*/locale/index.tsx',
|
|
'!components/*/__tests__/type.test.tsx',
|
|
'!components/**/*/interface.{ts,tsx}',
|
|
'!components/*/__tests__/image.test.{ts,tsx}',
|
|
'!components/*/__tests__/demo-semantic.test.tsx',
|
|
'!components/__tests__/node.test.tsx',
|
|
'!components/*/demo/*.tsx',
|
|
'!components/*/design/**',
|
|
],
|
|
transformIgnorePatterns,
|
|
globals: {
|
|
'ts-jest': {
|
|
tsConfig: './tsconfig.test.json',
|
|
},
|
|
},
|
|
testEnvironmentOptions: {
|
|
url: 'http://localhost',
|
|
},
|
|
// bail: true,
|
|
maxWorkers: '50%',
|
|
};
|