Skip to content

Commit

Permalink
Zl/v4.20.6 sync (#69)
Browse files Browse the repository at this point in the history
* docs: Add faq about chrome with upload

* feat: crossorigin attribute of Upload (ant-design#34981)

* feat: Add crossOrigin prop to thumbnail image

* feat: Add test cases about crossOrigin prop of Upload component

* doc: Add a description about crossOrigin prop to Upload component manual

* Update components/upload/interface.tsx

Update type definition using React.ImgHTMLAttributes

Co-authored-by: afc163 <[email protected]>

Co-authored-by: hyunseok.kim <[email protected]>
Co-authored-by: afc163 <[email protected]>

* docs: update faq (ant-design#34984)

* test: Update snapshot

* feat: Image preview support keyboard switch (ant-design#34992)

* style: remove selected item style of AutoComplete (ant-design#34996)

close ant-design#34975

* chore(deps-dev): bump react-helmet-async from 1.2.3 to 1.3.0 (ant-design#34997)

Bumps [react-helmet-async](https://github.com/staylor/react-helmet-async) from 1.2.3 to 1.3.0.
- [Release notes](https://github.com/staylor/react-helmet-async/releases)
- [Commits](https://github.com/staylor/react-helmet-async/commits)

---
updated-dependencies:
- dependency-name: react-helmet-async
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore: use ~ instead of ^ for rc-segmented

* docs: recommend S2 and ProTable in table documentation (ant-design#34998)

* docs: recommend S2 and ProTable in table documentation

* Update index.en-US.md

* Update index.en-US.md

* docs: changelog for 4.20.0-alpha.0 (ant-design#34977)

* docs: changelog for 4.20.0

* chore: bump version to 4.20.0

* docs: update version date

* chore: update version to 4.20.0-alpha.0

* docs: remove react 18 compatible

* fix: arrow radius use fixed value (ant-design#34999)

* fix: Spin rotate deg number (ant-design#35005)

close ant-design#34866

* docs(input): use Intl.NumberFormat (ant-design#34985)

Co-authored-by: maxin <[email protected]>

* chore(deps-dev): bump glob from 7.2.0 to 8.0.1 (ant-design#35017)

Bumps [glob](https://github.com/isaacs/node-glob) from 7.2.0 to 8.0.1.
- [Release notes](https://github.com/isaacs/node-glob/releases)
- [Changelog](https://github.com/isaacs/node-glob/blob/main/changelog.md)
- [Commits](isaacs/node-glob@v7.2.0...v8.0.1)

---
updated-dependencies:
- dependency-name: glob
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix(cascader): search result not fill the entire panel (ant-design#35019)

Co-authored-by: wanghao <[email protected]>

* fix: Select and AutoComplete scroll behavior by keyboard (ant-design#35025)

fix ant-design#34898
fix ant-design#35022

* chore: clean up some project files (ant-design#35028)

* chore: remove unused Upload in form styles (ant-design#35033)

* chore: remove unused Upload in form styles

* Update Upload.tsx

* Update Upload.tsx

* test: update snapshot

* fix: Notification & message throw `createRoot` warning in React 18 (ant-design#35030)

* chore: bump notification version

* test: notification test case

* test: more test case

* test: part message test

* test: rest message test

* test: notification config test

* feat: Form support useWatch (ant-design#35036)

* feat: Support useWatch

* test: update test case

* chore: update snapshot

* feat: Image PreviewGroup Support top progress rendering (ant-design#35038)

* refactor: wrap picker with FC (ant-design#34994)

* refactor: wrap picker with FC

* chore: code clean

* feat: cast type

* test: fix test

* test: Update snapshot

* docs: More info about useWatch (ant-design#35039)

* docs: more about useWatch

* test: Update test case

* docs: more info

* docs: more & more

* feat: add useFormInstance

* chore: add version info

* docs: simplify demo code, ant-design#30853 (ant-design#35050)

* style: cleanup upload unused styles (ant-design#35052)

* fix: Upload pass UploadList prefixCls (ant-design#34944)

* fix: pass UploadList prefixCls

* test: <Upload /> should pass <UploadList /> prefixCls

Co-authored-by: chenshanwang <[email protected]>

* Update overview.en-US.md

* docs: fix overview content (ant-design#35055)

* docs: 修复中文文档没有与英文文档同步的问题

* Apply suggestions from code review

* Apply suggestions from code review

* Apply suggestions from code review

* Apply suggestions from code review

Co-authored-by: afc163 <[email protected]>

* test: fix jest snapshot

* test: update test cases to testing-lib (ant-design#35056)

* test: migrate some test case to testing-library (ant-design#35062)

* test: migrate some test case to testing-library

* chore: code clean

* test: fix stylelint

* test: test case

* ci: up version (ant-design#35067)

* ci: up version

* Update verify-files-modify.yml

* docs: Update useWatch docs

* docs: update docs version

* docs: add 4.20.0-alpha.1 changelog (ant-design#35070)

* docs: add 4.20.0-alpha.1 changelog

* docs: update

* docs: Update changelog missing useFormInstance

* chore: rc-dialog id unique sync (ant-design#35072)

* chore: Compatible for @types/react@18 (ant-design#35075)

* chore: Compatible for @types/react@18

* chore: Compatible for @types/react@18

* chore: 🤖 component Steps ts def for react18 (ant-design#35076)

✅ Closes: ant-design#35074

Co-authored-by: ronggui.shu <[email protected]>

* test: wrap React.StrictMode for test cases (ant-design#35026)

* test: React StrictMode

* test: fix Spin test

* chore: wrapper enzyme

* test: fix setState

* test: more test cover

* test: more test cover

* test: more test cover

* test: more test cover

* test: more test cover

* test: more test case

* test: more test case

* test: more test case

* test: more test case

* test: more test case

* test: more test case

* test: more test case

* test: more test case

* test: more test case

* test: more test case

* test: more test case

* test: more test case

* test: disable part of it

* test: fix test & add placeholder

* test: Use orign enzyme mount

Co-authored-by: zombiej <[email protected]>

* test: Update snapshot

* fix: fixed arrow border radius variables (ant-design#35086)

* style: fix the problem of inconsistent styles in RTL mode (ant-design#35088)

* refactor: change anchor to fc for the cssinjs prepare (ant-design#35073)

* refactor: change anchor to fc for the cssinjs prepare

* fix: fix anchor test

* style: fix the style of progress rendering at the top of component Image PreviewGroup (ant-design#35092)

* style: fix the style of progress rendering at the top of component Image PreviewGroup

* style: add debug-demo for top progress countRender

* pref: upgrade rc-menu (ant-design#35071)

* pref: upgrade rc-menu

* Update package.json

Co-authored-by: afc163 <[email protected]>

* fix: Form in React 18 StrictMode (ant-design#35096)

* test: fix with react 18

* fix: Form in StrictMode

* test: clean up

* test: clean up

* chore: bump rc-motion version

* chore: fix test case logic

* test: back of it

* test: back missing test case

* docs: update Drawer overview image (ant-design#35099)

* docs: update Drawer overview image

* Update index.en-US.md

* chore: tweak upload style (ant-design#35097)

* chore: tweak upload style

* chore: update snapshot

* fix: cn menus doc (ant-design#35078)

* chore: update snapshot due to rc-trigger bumped (ant-design#35106)

* style: Switch background should not be transparent (ant-design#35103)

* docs: improve upload demos (ant-design#35104)

* docs: improve upload demos

* Update drag-sorting.md

* docs: add input showCount lose focus desc. close ant-design#35080

* chore: fix cirrus-actions/rebase

cirrus-actions/rebase#78

* fix(Typography): change less function to less variable in danger style (ant-design#35113)

* refactor: wrap Spin with FC (ant-design#35114)

* refactor: wrap Spin with FC

* chore: code clean

* fix: breadcrumb shows the number (ant-design#35123)

* docs: Add deprecated usage (ant-design#35128)

* docs: Update Menu demo sample

* docs: improve menu usage for items (ant-design#35131)

* docs: improve menu usage for items

* test: update snapshot

* docs: update menu title

* docs: update getContainer of Modal and Drawer (ant-design#35141)

close ant-design#35124

* chore: bump dropdown with inject mark (ant-design#35153)

* docs: Update Dropdown basic demo icon

* docs: Add dropdown menu missing keys

* chore: remove Breadcrumb Dropdown warning (ant-design#35162)

* fix: DropDownProps => DropdownProps (ant-design#35161)

* fix: DropDown => Dropdown

* chore: leave DropDownProps for compatibility

* docs: add Application Frameworks recommendation (ant-design#35168)

* docs: add Application Frameworks recommendation

* add Application Frameworks recommendation

* typo fix

* docs: segmented update (ant-design#35171)

* docs: segmented update

* test: fix lint

* docs: Update demo with Space (ant-design#35172)

* fix: small table selection dropdown margin issue

close ant-design#35167

* fix: small table selection dropdown margin issue (ant-design#35173)

close ant-design#35167

* docs: Update Dropdown demo

* fix: small/middle table selection dropdown margin issue (ant-design#35174)

* fix: small/middle table selection dropdown margin issue

* Update index.less

* refactor: Simplify Button Group Style (ant-design#35175)

* chore: refactor grp with context

* test: Update snapshot

* chore: clean up

* test: fix test case

* chore: clean up

* test: fix test

* docs: faq about modal. close ant-design#35177

* test: fix test in segmented (ant-design#35183)

* test(🏞): batch upload snapshots to argos-ci.com (ant-design#35181)

* fix: Upload interface generic type (ant-design#35158)

* fix:Uplooad组件UploadChangeParam fileList不使用范型

* feat:upload component interface generic test

* docs(🛡): update README badges (ant-design#35185)

* docs: update README-zh_CN.md

* Update README-uk_UA.md

* Update README-pt_BR.md

* chore: fix argos-ci upload BATCH_SIZE

* fix: code to use @html-selector variable (ant-design#35186)

* revert: batchCount of argos-ci

revert 2d654bf

* docs: add debug demo for segmented (ant-design#35176)

* docs: add debug demo for segmented

* chore: update

* chore: update

* style: `Segmented` supports rtl styles (ant-design#35188)

* perf: optimize calculation of filteredKeysIsAllControlled (ant-design#35064)

* perf: optimize calculation of filteredKeysIsAllControlled

* fix: ci failure

* fix: modify codes by suggestion

* chore: fix argos-ci check status in PR (ant-design#35193)

* chore: batch upload argos-ci snapshots

* test: added commit and branch back for ui-upload.yml

* feat: upgrade rc-segmented v2 (ant-design#35187)

* docs: add debug demo for segmented

* chore: update

* feat: upgrade rc-segmented v2

* Update components/segmented/__tests__/index.test.tsx

Co-authored-by: afc163 <[email protected]>

* Update components/segmented/demo/controlled-two.md

Co-authored-by: afc163 <[email protected]>

Co-authored-by: afc163 <[email protected]>

* site: tweak theme button margin of site footer (ant-design#35192)

* fix: remove Tabs overflow hidden style (ant-design#35195)

close ant-design#34021
close ant-design#35136

* docs: add demo link for Menu legacy usage (ant-design#35202)

* docs: add demo links for Menu legacy usage

* Update index.en-US.md

* chore: update ui.yml

* docs: 4.20.0 changelog (ant-design#35203)

* docs: init 4.20.0 changelog

* chore: merge

* Update CHANGELOG.zh-CN.md

Co-authored-by: afc163 <[email protected]>

* docs: Update changelog

* chore: bump react version

* chore: revert react version

* Update CHANGELOG.zh-CN.md

Co-authored-by: afc163 <[email protected]>

Co-authored-by: afc163 <[email protected]>

* docs: fix changelog date

* docs: Update Segmented changelog

* docs: Note for 18 known issue

* test: Replace transfer part test with testing lib (ant-design#35216)

* test: Replace transfer part test with testing lib

* chore: clean up

* fix: upload circle ref (ant-design#34379)

Co-authored-by: kanweiwei <[email protected]>

* chore: add useWatch test placeholder

* chore: run image snapshots on every branches

* style: fix Breadcrumb reset style (ant-design#35235)

close ant-design#35233

* fix: input onSearch trigger wrongly (ant-design#34844) (ant-design#35164)

Co-authored-by: [email protected] <[email protected]>

* docs(:sparkles:): release 4.20.1 (ant-design#35250)

* test: add menu focus test (ant-design#35252)

* test: fix upload test case

* test: skip uploadlist test for now

* docs: replace `git.io` link with the original URL (ant-design#35261)

* fix: Table columns sorter a11y experience (ant-design#35269)

* Make table sortable columns focusable and keyboard accessible.

* Fix typo.

* Change focus style for sortable table column header from broken outline to color text.

* Update snapshots.

* Change order to fix lint error.

* Add unit test to test sorting with keypress.

* Update components/table/hooks/useSorter.tsx

* chore: improve code style

* style: use focus-visible

* fix: test case

* test: update snapshot

Co-authored-by: Katsiaryna Pustakhod <[email protected]>

* feat: support icon only in segmented (ant-design#35256)

* feat: support icon only with segmented

* fix: lint issue

* chore: update

* test: fix

* test: update snapshot

* feat: dropdown auto-focus (ant-design#35307)

* feat: dropdown auto-focus

* chore: update rc-tabs

* docs: update space demos

* fix: Space duplicated key warning (ant-design#35311)

close ant-design#35305

* Added pending filter translations Table locale/es_ES (ant-design#35309)

Co-authored-by: Jesús Gallego Irles <[email protected]>

* chore: Add code file owner

* chore: more owner files

* docs: fix form instance type error (ant-design#35320)

* feat: set proper height for Segmented (ant-design#35281)

* style: tweak BreadCrumb link hover color (ant-design#35324)

* chore: Aligning the CI description and its behavior (ant-design#35325)

* test: Rewrite mountTest with testing lib (ant-design#35326)

* docs: add instruction about tokenSeparators (ant-design#35329)

* test: replace Empty part test with test lib (ant-design#35289)

* test: replace Empty part test with test lib

* test: update snapshot case

* fix: Switch disabled color in dark theme (ant-design#35332)

* Revert "feat: dropdown auto-focus (ant-design#35307)" (ant-design#35337)

This reverts commit 1ff58d2.

* docs: update Tabs component  onEdit prop describe (ant-design#35271)

* docs: update Tabs component  onEdit prop describe

* docs: update Tabs component  onEdit prop describe

* Apply suggestions from code review

Co-authored-by: afc163 <[email protected]>

* docs: changelog for 4.20.2 (ant-design#35338)

* docs: add changelog for ant-design#35336

* style: fix Select tag remove icon position (ant-design#35336)

The icon is pushed down a bit

* test: update test case

* test: transfer part of tooltip test case to testing library (ant-design#35362)

* test: refactor test cases of Space (ant-design#35372)

* test: migrate part of anchor tests (ant-design#35371)

* test: migrate part of checkbox tests (ant-design#35354)

* fix: Carousel compatible with vertical property (ant-design#35349)

* chore: fix npm start error in Gitpod

close ant-design#33444

* Revert "chore: fix npm start error in Gitpod"

This reverts commit 978226f.

* fix: table column filter reset is not working (ant-design#35226) (ant-design#35386)

* fix: Respect user provided space item key (ant-design#35344)

* Resolve Ant Design Notification component TypeScript error via adding maxCount as an ArgsProps property (ant-design#35369)

* fix: use less variables for Segmented (ant-design#35387)

* docs: reverse React 18 demo

* test: replace textarea some test case with testing lib (ant-design#35398)

* test: replace textarea some test case with testing lib

* test: full process

* test: mv input test to input scope

* test: fix lint

* chore: rm useless console

* chore: rm CODEOWNER since this block github action

* test: transfer tooltip test case to testing library

* ci: trigger the pr check

* test: try to fix the pr check

* test: remove some test case

* test: foreach all placement

* fix(<Row/>): wipe out unnecessary prop (ant-design#35409)

* fix: wipe out unnecessary prop

* wipe out unnecessary prop(`row-gap: 0px`) on <Row />

* add test case

* chore: remove unnecessary import

* chore: add  prop to Row and Col

* chore: update snapshot (Form/Grid/Card)

* chore: update snapshot

* chore: move  location

* docs: explain Avatar fallback strategy (ant-design#35415)

The original description was unclear, incomplete, and confusing, requiring a look at the code to understand it, so I revised it to a more understandable version.

* fix: arrow style (ant-design#35401)

* fix: arrow style

* fix: raise arrow z-index

* fix: fix defualt arrow color

* fix: mix shadow

* chore: code clean

* chore: code clean

* fix: use fadeout instead

* test: fix style lint

* test: replace some slepp with jest.runAllTimers

* Revert "test: replace some slepp with jest.runAllTimers"

This reverts commit ad886d1.

* fix: List.Item ref (ant-design#35321)

* fix: list item ref

* add test

* improve

* fix: List.Item typescript (ant-design#35418)

* chore: eslint add consistent-type-imports (ant-design#35419)

* chore: eslint add consistent-type-imports

* fix avatar

* Update Item.tsx

* chore: change menu icon in site

* docs: update mirror link (ant-design#35424)

* docs: update mirror link

* feat: add modal

* feat: add icon

* chore: code clean

* feat: text

* fix: cancel btn

* chore: split chunks (ant-design#35222)

* chore: split chunks

* chore: update bisheng version

* chore: split @ant-design/icon

* chore: code clean

* chore: test

* chore: split moment

* chore: code clean

* fix: add missing localizations (ant-design#35430)

* Add missing localizations

* Update snapshot

* docs: add 4.20.3 changelog (ant-design#35435)

* docs: add 4.20.3 changelog

* Update CHANGELOG.zh-CN.md

Co-authored-by: afc163 <[email protected]>

* fix typo

* Update CHANGELOG.zh-CN.md

Co-authored-by: afc163 <[email protected]>

* Update CHANGELOG.en-US.md

Co-authored-by: afc163 <[email protected]>

* Update CHANGELOG.zh-CN.md

Co-authored-by: afc163 <[email protected]>

* fix typo

* fix typo

* fix typo

* fix typo

Co-authored-by: afc163 <[email protected]>

* docs: update demo template (ant-design#35440)

* docs: fix typo (ant-design#35439)

* chore: fixed typo

* chore: fixed typo+1

* chore(deps-dev): bump husky from 7.0.4 to 8.0.1 (ant-design#35451)

Bumps [husky](https://github.com/typicode/husky) from 7.0.4 to 8.0.1.
- [Release notes](https://github.com/typicode/husky/releases)
- [Commits](typicode/husky@v7.0.4...v8.0.1)

---
updated-dependencies:
- dependency-name: husky
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* test: update snapshot (ant-design#35452)

* chore: optimze LGTM (ant-design#35443)

* chore: optimze LGTM

* chore: type

* fix: dev broken (ant-design#35453)

* chore(deps-dev): upgrade to jest 28 (ant-design#35334)

https://jestjs.io/zh-Hans/docs/upgrading-to-jest28

* fix: bad List.Item type (ant-design#35454) (ant-design#35455)

Co-authored-by: Ron Smeral <[email protected]>

* docs: replace class component with hooks (ant-design#35461)

* docs(badge): replace class component with hooks

* docs(button): replace class component with hooks

* docs(calendar): replace class component with hooks

* docs(card): replace class component with hooks

* docs(button): replace class component with hooks

* chore(deps): remove webpack devDependencies

* refactor: remove cascader displayRender warning (ant-design#35417)

* refactor: remove useless warning (ant-design#35291)

* refactor: remove useless test case

* docs: remove cascader tagRender

* perf: refactor devWarning for production code size (ant-design#35411)

* pref: better code style for production

* refactor `devWarning`

* don't use `useEffect` only wrap `devWarning`

* chore: add 'noop' to coverage

* chore: add test cases for devWarning

* chore: add test case

* chore: update test cases for devWarning

* chore: restore test script command

* fix: remove 'throw new Error'

* should not use `throw` for browser

* chore: update test case for AutoComplete

* perf: add prefix for `devWarning`

* update RegExp for UMD

* add prefix for ES and CJS

* chore: better code style

* perf:

* upgrade antd-tools

* remove `injectWarningCondition`

* rename `devWarning` to `warning`

* chore: better code style

* chore: better code style

* chore: restore hasValidName

* docs: replace class component with hooks (ant-design#35472)

* docs(badge): replace class component with hooks

* docs(button): replace class component with hooks

* docs(calendar): replace class component with hooks

* docs(card): replace class component with hooks

* docs(button): replace class component with hooks

* chore(deps): remove webpack devDependencies

* docs(cascader): replace class component with hooks

* docs(checkbox): replace class component with hooks

* docs(collapse): replace class component with hooks

* docs(comment): replace class component with hooks

* docs(descriptions): replace class component with hooks

* chore: fix LGTM

* docs: indicate that menu items require `key`s (ant-design#35474)

* docs: remove editable in table documentation

close
ant-design#35471 (comment)

* fix: tree checkbox margin in rtl mode (ant-design#35491)

* docs: Table QA about rowSelection renderCell (ant-design#35494)

* Update index.zh-CN.md

之前需要在 可选列的勾选框 中增加 Tooltip,没有在文档中找到相关的文档,通过搜索 issue,以为暂时不支持,看了源码才发现已经支持了。

所以想要完善一下文档,可以方便其他用户找到此内容。

* docs: Table QA about rowSelection renderCell

update US doc

* docs: changelog 4.20.4 (ant-design#35495)

* docs: changelog 4.20.4

* chore: emoji

* docs: replace class component with hooks (ant-design#35500)

* docs(badge): replace class component with hooks

* docs(button): replace class component with hooks

* docs(calendar): replace class component with hooks

* docs(card): replace class component with hooks

* docs(button): replace class component with hooks

* chore(deps): remove webpack devDependencies

* docs(cascader): replace class component with hooks

* docs(checkbox): replace class component with hooks

* docs(collapse): replace class component with hooks

* docs(comment): replace class component with hooks

* docs(descriptions): replace class component with hooks

* docs(config-provider): replace class component with hooks

* docs(date-picker): replace class component with hooks

* fix(statistic): ignore the decimal part when the precision is negative (ant-design#35520)

* test: Update snapshot

* test: Update snapshot (ant-design#35529)

* docs: update work with us part

* feat: update changelog

* test: moving to testing-library in `Segmented` (ant-design#35538)

* test(Segmented): moving to testing-library

* chore: cleanup

* fix: test

* test: use click instead of change to fire event

* Update index.test.tsx

* docs: replace class component with hooks (ant-design#35519)

* docs(badge): replace class component with hooks

* docs(button): replace class component with hooks

* docs(calendar): replace class component with hooks

* docs(card): replace class component with hooks

* docs(button): replace class component with hooks

* chore(deps): remove webpack devDependencies

* docs(cascader): replace class component with hooks

* docs(checkbox): replace class component with hooks

* docs(collapse): replace class component with hooks

* docs(comment): replace class component with hooks

* docs(descriptions): replace class component with hooks

* docs(config-provider): replace class component with hooks

* docs(date-picker): replace class component with hooks

* docs(drawer): replace class component with hooks

* docs(dropdown): replace class component with hooks

* docs(dropdown): replace class component with hooks

* docs(empty): replace class component with hooks

* docs(grid): replace class component with hooks

* docs(input): replace class component with hooks

* docs(input-number): replace class component with hooks

* docs(demo): fix lint error

* chore: deprecated rowSelection.onSelectNone and onSelectMultiple (ant-design#35545)

* chore: del unused package && downgrade some packages which related webpack@5 (ant-design#35551)

* docs: changelog 4.20.5 (ant-design#35560)

* chore: Update github action release helper release title

* fix: drawer close speed (ant-design#35339)

* fix: drawer close speed

* chroe: snap

* chroe: test

* chroe: test

* feat: remove file

* feat: 重新整理

* feat: forceRender

* feat: snap

* chroe: test

* chroe: test

* chroe: test

* feat: create event

* feat: diff code

* feat: forceRender

* chore: test (ant-design#35364)

* Update components/drawer/index.tsx

Co-authored-by: afc163 <[email protected]>

* feat: remove load state

* feat: test

* fix: destroyOnClose

* feat: add load

* fix: update snap

* fix: update snap

* feat: reset test

* feat: docs

* feat: test

* feat: test

Co-authored-by: afc163 <[email protected]>

* docs: fix 4.20.5 changelog typo (ant-design#35567)

* chore: delete extra spaces (ant-design#35582)

Co-authored-by: hezhaoshun <[email protected]>

* docs: replace class component with hooks (ant-design#35580)

* docs(badge): replace class component with hooks

* docs(button): replace class component with hooks

* docs(calendar): replace class component with hooks

* docs(card): replace class component with hooks

* docs(button): replace class component with hooks

* chore(deps): remove webpack devDependencies

* docs(cascader): replace class component with hooks

* docs(checkbox): replace class component with hooks

* docs(collapse): replace class component with hooks

* docs(comment): replace class component with hooks

* docs(descriptions): replace class component with hooks

* docs(config-provider): replace class component with hooks

* docs(date-picker): replace class component with hooks

* docs(drawer): replace class component with hooks

* docs(dropdown): replace class component with hooks

* docs(dropdown): replace class component with hooks

* docs(empty): replace class component with hooks

* docs(grid): replace class component with hooks

* docs(input): replace class component with hooks

* docs(input-number): replace class component with hooks

* docs(demo): fix lint error

* docs(layout): replace class component with hooks

* docs(list): replace class component with hooks

* docs(mentions): replace class component with hooks

* docs: fix code review issue

* chore: bump tools version (ant-design#35594)

* style: fix Table header border when has rowSpan (ant-design#35591)

close ant-design#35577

* docs: Update CHANGELOG.zh-CN.md (ant-design#35604)

* Update rebase.yml

* docs: Fix DatePicker throw demo

* style: anchor text is overwritten (ant-design#35612)

Co-authored-by: hezhaoshun <[email protected]>

* docs: replace class component with hooks (ant-design#35613)

* docs(badge): replace class component with hooks

* docs(button): replace class component with hooks

* docs(calendar): replace class component with hooks

* docs(card): replace class component with hooks

* docs(button): replace class component with hooks

* chore(deps): remove webpack devDependencies

* docs(cascader): replace class component with hooks

* docs(checkbox): replace class component with hooks

* docs(collapse): replace class component with hooks

* docs(comment): replace class component with hooks

* docs(descriptions): replace class component with hooks

* docs(config-provider): replace class component with hooks

* docs(date-picker): replace class component with hooks

* docs(drawer): replace class component with hooks

* docs(dropdown): replace class component with hooks

* docs(dropdown): replace class component with hooks

* docs(empty): replace class component with hooks

* docs(grid): replace class component with hooks

* docs(input): replace class component with hooks

* docs(input-number): replace class component with hooks

* docs(demo): fix lint error

* docs(layout): replace class component with hooks

* docs(list): replace class component with hooks

* docs(mentions): replace class component with hooks

* docs: fix code review issue

* docs(modal): replace class component with hooks

* docs: feat components TS demo (ant-design#34742)

* docs: add general components TS demo

* docs: add layout components TS demo

* docs: add navigation components TS demo

* docs: add data entry components TS demo

* chore(deps): add types for qs

* docs: add data display TS demo

* docs: add feedback components TS demo

* docs: add other components TS demo

* chore(deps): add types

* docs: unified demo code style

* docs: fix lint error

* docs: add demo TS type

* docs: fix demo TS type

* test: update snapshot

* docs: fix TS demo

* feat: update Rate character type

* docs: fix lint error

* feat: update Rate character type

* feat: update Rate character type

* fix: Remove Grid row and cell aria roles (ant-design#35616)

close ant-design#35549

* test: move test cases to `@testing/library` for Result (ant-design#35621)

* fix: incorrect position of picker popup (ant-design#35620)

Co-authored-by: yangpj17 <[email protected]>

close ant-design#35590

* feat: add-testing-lib (ant-design#35626)

* docs: Convert part demo to ts version (ant-design#35641)

* docs(badge): replace class component with hooks

* docs(button): replace class component with hooks

* docs(calendar): replace class component with hooks

* docs(card): replace class component with hooks

* docs(button): replace class component with hooks

* chore(deps): remove webpack devDependencies

* docs(cascader): replace class component with hooks

* docs(checkbox): replace class component with hooks

* docs(collapse): replace class component with hooks

* docs(comment): replace class component with hooks

* docs(descriptions): replace class component with hooks

* docs(config-provider): replace class component with hooks

* docs(date-picker): replace class component with hooks

* docs(drawer): replace class component with hooks

* docs(dropdown): replace class component with hooks

* docs(dropdown): replace class component with hooks

* docs(empty): replace class component with hooks

* docs(grid): replace class component with hooks

* docs(input): replace class component with hooks

* docs(input-number): replace class component with hooks

* docs(demo): fix lint error

* docs(layout): replace class component with hooks

* docs(list): replace class component with hooks

* docs(mentions): replace class component with hooks

* docs: fix code review issue

* docs(modal): replace class component with hooks

* docs(pagination): replace class component with hooks

* docs(popconfirm): replace class component with hooks

* docs(popover): replace class component with hooks

* docs(progress): replace class component with hooks

* docs(rate): replace class component with hooks

* docs(radio): replace class component with hooks

* docs: jsx to TS demo

* test: improve Select test case (ant-design#35633)

* docs(mentions): fix debounce demo bug (ant-design#35653)

* chore(deps-dev): bump @types/react-resizable from 1.7.4 to 3.0.0 (ant-design#35658)

Bumps [@types/react-resizable](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react-resizable) from 1.7.4 to 3.0.0.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react-resizable)

---
updated-dependencies:
- dependency-name: "@types/react-resizable"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* test: refactor test cases of Timeline with testing library (ant-design#35654)

* test: refactor test cases of TimeLine

* fix: lint errors

* chore(deps-dev): bump react-intl from 5.25.1 to 6.0.1 (ant-design#35659)

Bumps [react-intl](https://github.com/formatjs/formatjs) from 5.25.1 to 6.0.1.
- [Release notes](https://github.com/formatjs/formatjs/releases)
- [Commits](https://github.com/formatjs/formatjs/compare/[email protected]@6.0.1)

---
updated-dependencies:
- dependency-name: react-intl
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore: fix cheerio for enzyme fix (ant-design#35666)

* docs: 4.20.6 changelog (ant-design#35671)

* docs: 4.20.6 changelog

* docs: fix build

* chore: short auto merge time

* chore: update issue check mirror (ant-design#35680)

* fix: division in less for Segmented (ant-design#35701)

* fix: division in less for Segmented

* fix: update

* chore: increase bundle size (ant-design#35709)

* docs: fix mistype (ant-design#35714)

* docs: update demo code (ant-design#35695)

* docs: update demo code

* chore: increase bundle size

* Revert "chore: increase bundle size"

This reverts commit 1c75e5a.

* fix: drawer can not ref form instance when open (ant-design#35706)

* fix: drawer can not ref form instance when open

* fix: test

* feat: div ref

* feat: test

* feat: test

* feat: test

* feat: test

* chore: lock stylelint (ant-design#35725)

* fix: Popover arrow style (ant-design#35717)

* test: Replace alert part test with testing lib (ant-design#35736)

Co-authored-by: chenkan1 <[email protected]>

* chore(deps-dev): bump typescript from 4.6.4 to 4.7.2 (ant-design#35737)

Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.6.4 to 4.7.2.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](microsoft/TypeScript@v4.6.4...v4.7.2)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* docs(select): fix type  (ant-design#35726)

* fix: demo ts type

* mend

* Update select-users.md

* chore: move `@types/qs` from deps to devDeps (ant-design#35747)

* fix: the ts wrong of card inteface (ant-design#35753)

* fix: the ts wrong of card inteface

* fix: add export cardproprs

* feat: add card type test

* docs(👍): update recommendation (ant-design#35758)

* docs: update recommendation

* Update recommendation.en-US.md

* docs: fix skeleton demo (ant-design#35760)

* feat: change the changelog of 4.20.6 version

Co-authored-by: zombiej <[email protected]>
Co-authored-by: Hyunseok.Kim <[email protected]>
Co-authored-by: hyunseok.kim <[email protected]>
Co-authored-by: afc163 <[email protected]>
Co-authored-by: PCCCCCCC <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Peach <[email protected]>
Co-authored-by: MadCcc <[email protected]>
Co-authored-by: maxin <[email protected]>
Co-authored-by: maxin <[email protected]>
Co-authored-by: 王浩 <[email protected]>
Co-authored-by: wanghao <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: zhang lay <[email protected]>
Co-authored-by: chensw <[email protected]>
Co-authored-by: chenshanwang <[email protected]>
Co-authored-by: c0dedance <[email protected]>
Co-authored-by: xrkffgg <[email protected]>
Co-authored-by: AliRezaBeigy <[email protected]>
Co-authored-by: littledian <[email protected]>
Co-authored-by: ronggui.shu <[email protected]>
Co-authored-by: Long Hao (龙濠) <[email protected]>
Co-authored-by: Karott Schu <[email protected]>
Co-authored-by: nuintun <[email protected]>
Co-authored-by: TrickyPi <[email protected]>
Co-authored-by: Ömer Faruk APLAK <[email protected]>
Co-authored-by: vagusX <[email protected]>
Co-authored-by: rendaoer <[email protected]>
Co-authored-by: Jefferson Rafael Kozerski <[email protected]>
Co-authored-by: Yuyao Nie <[email protected]>
Co-authored-by: Camol <[email protected]>
Co-authored-by: kanweiwei <[email protected]>
Co-authored-by: qyzzzz <[email protected]>
Co-authored-by: [email protected] <[email protected]>
Co-authored-by: Sukka <[email protected]>
Co-authored-by: Katsiaryna Pustakhod <[email protected]>
Co-authored-by: agarciaguillo <[email protected]>
Co-authored-by: Jesús Gallego Irles <[email protected]>
Co-authored-by: Dunqing <[email protected]>
Co-authored-by: Amumu <[email protected]>
Co-authored-by: Zack Chang <[email protected]>
Co-authored-by: lalalazero <[email protected]>
Co-authored-by: Dreamcreative <[email protected]>
Co-authored-by: Walid Cherhane <[email protected]>
Co-authored-by: linqiqi077 <[email protected]>
Co-authored-by: haipeng <[email protected]>
Co-authored-by: Yanlin Jiang <[email protected]>
Co-authored-by: Cooper Veysey <[email protected]>
Co-authored-by: parabolazz <[email protected]>
Co-authored-by: Tom Xu <[email protected]>
Co-authored-by: Mykyta Velykanov <[email protected]>
Co-authored-by: 陈帅 <[email protected]>
Co-authored-by: Yanming Deng <[email protected]>
Co-authored-by: Ron Šmeral <[email protected]>
Co-authored-by: Ron Smeral <[email protected]>
Co-authored-by: dingkang <[email protected]>
Co-authored-by: Tony Wu <[email protected]>
Co-authored-by: miracles1919 <[email protected]>
Co-authored-by: limingxin <[email protected]>
Co-authored-by: ty888 <[email protected]>
Co-authored-by: 叶枫 <[email protected]>
Co-authored-by: joson <[email protected]>
Co-authored-by: hezhaoshun <[email protected]>
Co-authored-by: 周晨阳 <[email protected]>
Co-authored-by: 章鱼 <[email protected]>
Co-authored-by: Bart Piotrowski <[email protected]>
Co-authored-by: yykoypj <[email protected]>
Co-authored-by: 黑雨 <[email protected]>
Co-authored-by: Niyaz Akhmetov <[email protected]>
Co-authored-by: 社长长 <[email protected]>
Co-authored-by: chenkan1 <[email protected]>
Co-authored-by: zhao-huo-long <[email protected]>
Co-authored-by: Cong Zhang <[email protected]>
  • Loading branch information
Show file tree
Hide file tree
Showing 736 changed files with 9,435 additions and 9,339 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/issue-open-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,13 @@ jobs:
* Ant Motion: https://motion.ant.design
## 国内镜像
* Infra Design: http://ant-design.gitee.io
* Infra Design 3.x: http://ant-design-3x.gitee.io
* Infra Design 2.x: http://ant-design-2x.gitee.io
* Infra Design 1.x: http://ant-design-1x.gitee.io
* Infra Design Pro: http://ant-design-pro.gitee.io
* Infra Design Mobile: http://antd-mobile.gitee.io
* 官方镜像: https://ant-design.antgroup.com/
* Gitee 镜像: http://ant-design.gitee.io
* Ant Design 3.x: http://ant-design-3x.gitee.io
* Ant Design 2.x: http://ant-design-2x.gitee.io
* Ant Design 1.x: http://ant-design-1x.gitee.io
* Ant Design Pro: http://ant-design-pro.gitee.io
* Ant Design Mobile: http://antd-mobile.gitee.io
* Ant Motion: http://ant-motion.gitee.io
* Ant Design Pro Preview : https://prosite.z23.web.core.windows.net
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-check-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: PR Check CI

on:
schedule:
- cron: "*/10 * * * *"
- cron: "*/5 * * * *"

permissions:
contents: read
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rebase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ jobs:
with:
fetch-depth: 0
- name: Automatic Rebase
uses: cirrus-actions/rebase@1.6
uses: cirrus-actions/rebase@1.7
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .github/workflows/release-helper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
branch: 'master'
dingding-token: ${{ secrets.DINGDING_BOT_TOKEN }} ${{ secrets.DINGDING_BOT_BIGFISH_TOKEN }}
dingding-msg: 'CHANGELOG.zh-CN.md'
msg-title: '# Ant Design {{v}} 发布日志'
msg-poster: 'https://gw.alipayobjects.com/mdn/rms_08e378/afts/img/A*zx7LTI_ECSAAAAAAAAAAAABkARQnAQ'
msg-footer: '💬 前往 [**Ant Design Releases**]({{url}}) 查看更新日志'
prettier: true
Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ timeline: true

| infrad version | antd version | update content | time |
| --- | --- | --- | --- |
| 4.20.6 | 4.20.6 | Synchronize the update of antd 4.20.6 version | 2022-05-30 |
| 4.20.4 | 4.20.4 | Synchronize the update of antd 4.20.4 version | 2022-05-13 |
| 4.20.0 | 4.20.0 | Synchronize the update of antd 4.20.0 version | 2022-04-26 |
| 4.19.5 | 4.19.5 | Synchronize the update of antd 4.19.5 version | 2022-04-07 |
Expand All @@ -33,6 +34,23 @@ if you have some problem, welcome to connect `[email protected]` or `lay.z

---

## 4.20.6

`2022-05-22`

- 🐞 Fix DatePicker placeholder flush when open first time. [#35620](https://github.com/ant-design/ant-design/pull/35620) [@yykoypj](https://github.com/yykoypj)
- 🛠 Remove Grid default `role` attr to fit [aria-required-parent](https://accessibilityinsights.io/info-examples/web/aria-required-parent/) requirement. [#35616](https://github.com/ant-design/ant-design/pull/35616) [@bartpio](https://github.com/bartpio)
- 🐞 Fix Anchor cut content in some browser. [#35612](https://github.com/ant-design/ant-design/pull/35612) [@josonho](https://github.com/josonho)
- 🐞 Fix Table header cell border when have `rowSpan` and `scroll.y`. [#35591](https://github.com/ant-design/ant-design/pull/35591)
- 🐞 Fix Drawer that the button in it closes too fast issue. [#35339](https://github.com/ant-design/ant-design/pull/35339)

## 4.20.5

`2022-05-15`

- 🤖 Deprecated Table `rowSelection.onSelectNone` and `rowSelection.onSelectMultiple` in TS type. [#35545](https://github.com/ant-design/ant-design/pull/35545)
- 🐞 Ignore the decimal part in InputNumber when `precision` is negative. [#35520](https://github.com/ant-design/ant-design/pull/35520) [@ty888](https://github.com/ty888)

## 4.20.4

`2022-05-11`
Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ timeline: true

| infrad 版本号 | 对应 antd 版本号 | 更新内容 | 时间 |
| --- | --- | --- | --- |
| 4.20.6 | 4.20.6 | 同步 antd 4.20.6 版本的更新 | 2022-05-30 |
| 4.20.4 | 4.20.4 | 同步 antd 4.20.4 版本的更新 | 2022-05-13 |
| 4.20.0 | 4.20.0 | 同步 antd 4.20.0 版本的更新 | 2022-04-26 |
| 4.19.5 | 4.19.5 | 同步 antd 4.19.5 版本的更新 | 2022-04-07 |
Expand All @@ -33,6 +34,23 @@ timeline: true

---

## 4.20.6

`2022-05-22`

- 🐞 修复 DatePicker 初次打开时 placeholder 闪烁的问题。[#35620](https://github.com/ant-design/ant-design/pull/35620) [@yykoypj](https://github.com/yykoypj)
- 🛠 移除 Grid 默认 `role` 标签,以使其更好的适配 [aria-required-parent](https://accessibilityinsights.io/info-examples/web/aria-required-parent/) 要求。[#35616](https://github.com/ant-design/ant-design/pull/35616) [@bartpio](https://github.com/bartpio)
- 🐞 修复 Anchor 在某些游览器下会被切割内容的问题。[#35612](https://github.com/ant-design/ant-design/pull/35612) [@josonho](https://github.com/josonho)
- 🐞 修复 Table 存在表头分组和垂直滚动条时表头边框异常的问题。[#35591](https://github.com/ant-design/ant-design/pull/35591)
- 🐞 修复 Drawer 内按钮关闭速度过快问题。[#35339](https://github.com/ant-design/ant-design/pull/35339)

## 4.20.5

`2022-05-15`

- 🤖 在 TypeScript 定义中废弃 Table `rowSelection.onSelectNone``rowSelection.onSelectMultiple`[#35545](https://github.com/ant-design/ant-design/pull/35545)
- 🐞 InputNumber 当精度为负数时忽略小数部分。[#35520](https://github.com/ant-design/ant-design/pull/35520) [@ty888](https://github.com/ty888)`

## 4.20.4

`2022-05-11`
Expand Down
4 changes: 2 additions & 2 deletions components/affix/demo/basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The simplest usage.
import React, { useState } from 'react';
import { Affix, Button } from 'infrad';

const Demo: React.FC = () => {
const App: React.FC = () => {
const [top, setTop] = useState(10);
const [bottom, setBottom] = useState(10);

Expand All @@ -38,5 +38,5 @@ const Demo: React.FC = () => {
);
};

export default Demo;
export default App;
```
5 changes: 3 additions & 2 deletions components/affix/demo/debug.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ DEBUG
import React, { useState } from 'react';
import { Affix, Button } from 'infrad';

const Demo: React.FC = () => {
const App: React.FC = () => {
const [top, setTop] = useState(10);

return (
<div style={{ height: 10000 }}>
<div>Top</div>
Expand All @@ -35,5 +36,5 @@ const Demo: React.FC = () => {
);
};

export default Demo;
export default App;
```
5 changes: 4 additions & 1 deletion components/affix/demo/on-change.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ title:
Callback with affixed state.

```tsx
import React from 'react';
import { Affix, Button } from 'infrad';

export default () => (
const App: React.FC = () => (
<Affix offsetTop={120} onChange={affixed => console.log(affixed)}>
<Button>120px to affix top</Button>
</Affix>
);

export default App;
```
5 changes: 3 additions & 2 deletions components/affix/demo/target.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ Set a `target` for 'Affix', which is listen to scroll event of target element (d
import React, { useState } from 'react';
import { Affix, Button } from 'infrad';

const Demo: React.FC = () => {
const App: React.FC = () => {
const [container, setContainer] = useState<HTMLDivElement | null>(null);

return (
<div className="scrollable-container" ref={setContainer}>
<div className="background">
Expand All @@ -30,7 +31,7 @@ const Demo: React.FC = () => {
);
};

export default Demo;
export default App;
```

<style>
Expand Down
59 changes: 31 additions & 28 deletions components/alert/__tests__/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import React from 'react';
import { mount } from 'enzyme';
import { act } from 'react-dom/test-utils';
import Alert from '..';
import accessibilityTest from '../../../tests/shared/accessibilityTest';
import rtlTest from '../../../tests/shared/rtlTest';
import { fireEvent, render, sleep } from '../../../tests/utils';
import Button from '../../button';
import Tooltip from '../../tooltip';
import Popconfirm from '../../popconfirm';
import rtlTest from '../../../tests/shared/rtlTest';
import accessibilityTest from '../../../tests/shared/accessibilityTest';
import { sleep } from '../../../tests/utils';
import Alert from '..';
import Tooltip from '../../tooltip';

const { ErrorBoundary } = Alert;

Expand All @@ -25,17 +24,18 @@ describe('Alert', () => {

it('could be closed', () => {
const onClose = jest.fn();
const wrapper = mount(
const { container } = render(
<Alert
message="Warning Text Warning Text Warning TextW arning Text Warning Text Warning TextWarning Text"
type="warning"
closable
onClose={onClose}
/>,
);

act(() => {
jest.useFakeTimers();
wrapper.find('.ant-alert-close-icon').simulate('click');
fireEvent.click(container.querySelector('.ant-alert-close-icon')!);
jest.runAllTimers();
jest.useRealTimers();
});
Expand All @@ -44,7 +44,7 @@ describe('Alert', () => {

describe('action of Alert', () => {
it('custom action', () => {
const wrapper = mount(
const { container } = render(
<Alert
message="Success Tips"
type="success"
Expand All @@ -57,39 +57,39 @@ describe('Alert', () => {
closable
/>,
);
expect(wrapper.render()).toMatchSnapshot();
expect(container.firstChild).toMatchSnapshot();
});
});

it('support closeIcon', () => {
const wrapper = mount(
const { container } = render(
<Alert
closable
closeIcon={<span>close</span>}
message="Warning Text Warning Text Warning TextW arning Text Warning Text Warning TextWarning Text"
type="warning"
/>,
);
expect(wrapper.render()).toMatchSnapshot();
expect(container.firstChild).toMatchSnapshot();
});

describe('data and aria props', () => {
it('sets data attributes on input', () => {
const wrapper = mount(<Alert data-test="test-id" data-id="12345" message={null} />);
const input = wrapper.find('.ant-alert').getDOMNode();
const { container } = render(<Alert data-test="test-id" data-id="12345" message={null} />);
const input = container.querySelector('.ant-alert')!;
expect(input.getAttribute('data-test')).toBe('test-id');
expect(input.getAttribute('data-id')).toBe('12345');
});

it('sets aria attributes on input', () => {
const wrapper = mount(<Alert aria-describedby="some-label" message={null} />);
const input = wrapper.find('.ant-alert').getDOMNode();
const { container } = render(<Alert aria-describedby="some-label" message={null} />);
const input = container.querySelector('.ant-alert')!;
expect(input.getAttribute('aria-describedby')).toBe('some-label');
});

it('sets role attribute on input', () => {
const wrapper = mount(<Alert role="status" message={null} />);
const input = wrapper.find('.ant-alert').getDOMNode();
const { container } = render(<Alert role="status" message={null} />);
const input = container.querySelector('.ant-alert')!;
expect(input.getAttribute('role')).toBe('status');
});
});
Expand All @@ -101,29 +101,30 @@ describe('Alert', () => {
// @ts-expect-error
// eslint-disable-next-line react/jsx-no-undef
const ThrowError = () => <NotExisted />;
const wrapper = mount(
const { container } = render(
<ErrorBoundary>
<ThrowError />
</ErrorBoundary>,
);
// eslint-disable-next-line jest/no-standalone-expect
expect(wrapper.text()).toContain('ReferenceError: NotExisted is not defined');
expect(container.textContent).toContain('ReferenceError: NotExisted is not defined');
// eslint-disable-next-line no-console
(console.error as any).mockRestore();
});

it('could be used with Tooltip', async () => {
const ref = React.createRef<any>();
jest.useRealTimers();
const wrapper = mount(
const { container } = render(
<Tooltip title="xxx" mouseEnterDelay={0} ref={ref}>
<Alert
message="Warning Text Warning Text Warning TextW arning Text Warning Text Warning TextWarning Text"
type="warning"
/>
</Tooltip>,
);
wrapper.find('.ant-alert').simulate('mouseenter');
// wrapper.find('.ant-alert').simulate('mouseenter');
fireEvent.mouseEnter(container.querySelector('.ant-alert')!);
await sleep(0);
expect(ref.current.getPopupDomNode()).toBeTruthy();
jest.useFakeTimers();
Expand All @@ -132,27 +133,29 @@ describe('Alert', () => {
it('could be used with Popconfirm', async () => {
const ref = React.createRef<any>();
jest.useRealTimers();
const wrapper = mount(
const { container } = render(
<Popconfirm ref={ref} title="xxx">
<Alert
message="Warning Text Warning Text Warning TextW arning Text Warning Text Warning TextWarning Text"
type="warning"
/>
</Popconfirm>,
);
wrapper.find('.ant-alert').simulate('click');
fireEvent.click(container.querySelector('.ant-alert')!);
await sleep(0);
expect(ref.current.getPopupDomNode()).toBeTruthy();
jest.useFakeTimers();
});

it('could accept none react element icon', () => {
const wrapper = mount(<Alert message="Success Tips" type="success" showIcon icon="icon" />);
expect(wrapper.render()).toMatchSnapshot();
const { container } = render(
<Alert message="Success Tips" type="success" showIcon icon="icon" />,
);
expect(container.firstChild).toMatchSnapshot();
});

it('should not render message div when no message', () => {
const wrapper = mount(<Alert description="description" />);
expect(wrapper.exists('.ant-alert-message')).toBe(false);
const { container } = render(<Alert description="description" />);
expect(!!container.querySelector('.ant-alert-message')).toBe(false);
});
});
4 changes: 3 additions & 1 deletion components/alert/demo/action.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Custom action.
import React from 'react';
import { Alert, Button, Space } from 'infrad';

export default () => (
const App: React.FC = () => (
<>
<Alert
message="Success Tips"
Expand Down Expand Up @@ -71,6 +71,8 @@ export default () => (
/>
</>
);

export default App;
```

<style>
Expand Down
5 changes: 4 additions & 1 deletion components/alert/demo/banner.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ title:
Display Alert as a banner at top of page.

```tsx
import React from 'react';
import { Alert } from 'infrad';

export default () => (
const App: React.FC = () => (
<>
<Alert message="Warning text" banner />
<br />
Expand All @@ -32,4 +33,6 @@ export default () => (
<Alert type="error" message="Error text" banner />
</>
);

export default App;
```
5 changes: 4 additions & 1 deletion components/alert/demo/basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ title:
The simplest usage for short messages.

```tsx
import React from 'react';
import { Alert } from 'infrad';

export default () => <Alert message="Success Text" type="success" />;
const App: React.FC = () => <Alert message="Success Text" type="success" />;

export default App;
```

<style>
Expand Down
Loading

0 comments on commit e2374ec

Please sign in to comment.