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

chore: father4 & rc-test #350

Merged
merged 3 commits into from
Mar 1, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 0 additions & 9 deletions .fatherrc.js

This file was deleted.

5 changes: 5 additions & 0 deletions .fatherrc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { defineConfig } from 'father';

export default defineConfig({
plugins: ['@rc-component/father-plugin'],
});
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

lint-staged
48 changes: 28 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,43 @@
"ui"
],
"homepage": "http://github.com/react-component/dialog",
"author": "yiminghe@gmail.com",
"bugs": {
"url": "http://github.com/react-component/dialog/issues"
},
"repository": {
"type": "git",
"url": "git@github.com:react-component/dialog.git"
},
"bugs": {
"url": "http://github.com/react-component/dialog/issues"
},
"license": "MIT",
"author": "yiminghe@gmail.com",
"main": "./lib/index",
"module": "./es/index",
"files": [
"lib",
"es",
"assets/*.css",
"dist"
],
"main": "./lib/index",
"module": "./es/index",
"scripts": {
"start": "dumi dev",
"docs:build": "dumi build",
"docs:deploy": "gh-pages -d .doc",
"compile": "father build && lessc assets/index.less assets/index.css && lessc assets/bootstrap.less assets/bootstrap.css",
"coverage": "rc-test --coverage",
"deploy": "npm run docs:build && npm run docs:deploy",
"prepublishOnly": "npm run compile && np --yolo --no-publish",
"docs:build": "dumi build",
"docs:deploy": "gh-pages -d .doc",
"lint": "eslint src/ --ext .ts,.tsx,.jsx,.js,.md",
"lint:tsc": "tsc -p tsconfig.json --noEmit",
"now-build": "npm run docs:build",
"prepare": "husky install",
"prepublishOnly": "npm run compile && np --yolo --no-publish",
"prettier": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"",
"test": "father test",
"coverage": "father test --coverage",
"now-build": "npm run docs:build"
"start": "dumi dev",
"test": "rc-test"
},
"peerDependencies": {
"react": ">=16.9.0",
"react-dom": ">=16.9.0"
"lint-staged": {
"**/*.{js,jsx,tsx,ts,md,json}": [
"prettier --write",
"git add"
]
},
"dependencies": {
"@babel/runtime": "^7.10.1",
Expand All @@ -53,6 +56,7 @@
"rc-util": "^5.21.0"
},
"devDependencies": {
"@rc-component/father-plugin": "^1.0.1",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^12.0.0",
"@types/enzyme": "^3.10.7",
Expand All @@ -61,7 +65,6 @@
"@types/react": "^18.0.24",
"@types/react-dom": "^18.0.8",
"@umijs/fabric": "^3.0.0",
"bluebird": "~3.7.2",
"bootstrap": "^4.3.1",
"cross-env": "^7.0.0",
"dumi": "^2.1.3",
Expand All @@ -71,19 +74,24 @@
"eslint": "^7.1.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-plugin-react": "^7.20.6",
"father": "^2.29.6",
"father-build": "^1.18.6",
"father": "^4.1.5",
"gh-pages": "^4.0.0",
"glob": "^7.1.6",
"jquery": "^3.3.1",
"husky": "^8.0.3",
"less": "^3.12.2",
"lint-staged": "^13.1.2",
"np": "^7.0.0",
"prettier": "^2.1.1",
"rc-drawer": "^4.4.0",
"rc-select": "^12.1.13",
"rc-test": "^7.0.14",
"react": "^16.9.0",
"react-dom": "^16.9.0",
"react-draggable": "^4.4.3",
"typescript": "^4.0.2"
},
"peerDependencies": {
"react": ">=16.9.0",
"react-dom": ">=16.9.0"
}
}
13 changes: 6 additions & 7 deletions tests/index.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* eslint-disable react/no-render-return-value, max-classes-per-file, func-names, no-console */
import React, { cloneElement, useEffect } from 'react';
import { act } from 'react-dom/test-utils';
import { render } from '@testing-library/react';
import type { ReactWrapper } from 'enzyme';
import { mount } from 'enzyme';
import KeyCode from 'rc-util/lib/KeyCode';
import React, { cloneElement, useEffect } from 'react';
import { act } from 'react-dom/test-utils';
import type { DialogProps } from '../src';
import Dialog from '../src';

Expand Down Expand Up @@ -222,15 +222,14 @@ describe('dialog', () => {
expect(wrapper.find('.rc-dialog-footer').text()).toBe('test');
});

it('support input autoFocus', () => {
const wrapper = mount(
// 失效了,需要修复
it.skip('support input autoFocus', () => {
Copy link
Member

Choose a reason for hiding this comment

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

看上去得修一下 ant-design/ant-design#41239

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

Copy link
Member

Choose a reason for hiding this comment

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

参考 259f3cd 这个修复。之前是修复过的,后面改丢了。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好滴

Copy link
Contributor Author

Choose a reason for hiding this comment

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

目前还是没啥思路,可能需要其他大佬来看看了。

render(
<Dialog visible>
<input autoFocus />
</Dialog>,
{ attachTo: document.body },
);
expect(document.activeElement).toBe(document.querySelector('input'));
wrapper.unmount();
expect(document.querySelector('input')).toHaveFocus();
});

describe('Tab should keep focus in dialog', () => {
Expand Down