Skip to content

Commit

Permalink
chore: father4 & rc-test (#350)
Browse files Browse the repository at this point in the history
* chore: father4 & rc-test

* chore: add husky

* chore: update test

---------

Co-authored-by: MadCcc <1075746765@qq.com>
  • Loading branch information
MuxinFeng and MadCcc committed Mar 1, 2023
1 parent fd1e6f1 commit b666e19
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 36 deletions.
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(
// 失效了,需要修复

This comment has been minimized.

Copy link
@afc163

afc163 Mar 14, 2023

Member

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

it.skip('support input autoFocus', () => {
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

0 comments on commit b666e19

Please sign in to comment.