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

test: migrate tests to testing-library #539

Merged
merged 14 commits into from
Nov 30, 2023
7 changes: 2 additions & 5 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
const pkg = require('./package.json');
module.exports = {
snapshotSerializers: [require.resolve('enzyme-to-json/serializer')],
setupFilesAfterEnv: ['<rootDir>/tests/setupAfterEnv.ts'],
moduleNameMapper: {
[pkg.name]: '<rootDir>/src/index.ts',
'\\.less$': 'identity-obj-proxy',
},
collectCoverageFrom: [
'src/**',
'!src/locale/**',
],
collectCoverageFrom: ['src/**', '!src/locale/**'],
};
13 changes: 5 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@
],
"main": "./lib/index",
"module": "./es/index",
"types": "rc-pagination.d.ts",
"files": [
"assets/*.css",
"assets/*.less",
"es",
"lib",
"rc-pagination.d.ts"
"lib"
],
"homepage": "https://react-component.github.io/pagination",
"repository": {
Expand Down Expand Up @@ -50,6 +48,8 @@
},
"devDependencies": {
"@rc-component/father-plugin": "^1.0.0",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^14.0.0",
"@types/classnames": "^2.2.9",
"@types/jest": "^29.2.2",
"@types/keyv": "^4.2.0",
Expand All @@ -59,9 +59,6 @@
"coveralls": "^3.0.6",
"cross-env": "^7.0.0",
"dumi": "^2.1.2",
"enzyme": "^3.0.0",
"enzyme-adapter-react-16": "^1.15.6",
"enzyme-to-json": "^3.4.0",
"eslint": "^8.54.0",
"eslint-plugin-jest": "^27.6.0",
"eslint-plugin-unicorn": "^49.0.0",
Expand All @@ -76,8 +73,8 @@
"prettier": "^3.1.0",
"rc-select": "^14.1.2",
"rc-test": "^7.0.15",
"react": "^16.0.0",
"react-dom": "^16.0.0"
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"peerDependencies": {
"react": ">=16.9.0",
Expand Down
62 changes: 0 additions & 62 deletions rc-pagination.d.ts

This file was deleted.

7 changes: 6 additions & 1 deletion src/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ export interface PaginationData {
jumpNextIcon: React.ComponentType | React.ReactNode;
}

export interface PaginationProps extends Partial<PaginationData> {
export interface PaginationProps
extends Partial<PaginationData>,
React.AriaAttributes {
onChange?: (page: number, pageSize: number) => void;
onShowSizeChange?: (current: number, size: number) => void;
itemRender?: (
Expand All @@ -59,6 +61,9 @@ export interface PaginationProps extends Partial<PaginationData> {
element: React.ReactNode,
) => React.ReactNode;
showTotal?: (total: number, range: [number, number]) => React.ReactNode;

// WAI-ARIA
role?: React.AriaRole | undefined;
}
export interface PaginationState {
current: number;
Expand Down
27 changes: 0 additions & 27 deletions tests/__snapshots__/demo.test.js.snap

This file was deleted.

Loading
Loading