Skip to content

Commit

Permalink
test: migrate tests to testing-library (#539)
Browse files Browse the repository at this point in the history
* chore: remove ts description

* chore: update deps

* chore: migrate options.test

* chore: migrate demo.test

* chore: migrate data-aria.test

* chore: migrate itemRender.test

* chore: migrate jumper.test

* chore: migrate sizer.test

* chore: migrate two-pagination.test

* chore: migrate simple.test

* chore: migrate index.test

* chore: update

* chore: migrate .js => .tsx

* chore: supplement TS description
  • Loading branch information
Wxh16144 committed Nov 30, 2023
1 parent 2fc3308 commit 71be460
Show file tree
Hide file tree
Showing 23 changed files with 2,905 additions and 1,279 deletions.
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 {
Expand Down
27 changes: 0 additions & 27 deletions tests/__snapshots__/demo.test.js.snap

This file was deleted.

0 comments on commit 71be460

Please sign in to comment.