refator: update rc-dialog to remove rc-animate (#26940)

* chore: bump rc-dialog

* fix 1 test case

* test case

* more test

* fix confirm test case

* clean up

* fix snapshot

* update local-provider snapshot

* update Modal snapshot

* fix test of dialog hook

* fix lint
This commit is contained in:
二货机器人 2020-09-29 19:33:37 +08:00 committed by GitHub
parent 01d757b660
commit 442c146e3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 280 additions and 222 deletions

View File

@ -6810,7 +6810,7 @@ exports[`Locale Provider should display the text as ar 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle1"
@ -6819,7 +6819,7 @@ exports[`Locale Provider should display the text as ar 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -11851,7 +11851,7 @@ exports[`Locale Provider should display the text as az 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle0"
@ -11860,7 +11860,7 @@ exports[`Locale Provider should display the text as az 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -16892,7 +16892,7 @@ exports[`Locale Provider should display the text as bg 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle2"
@ -16901,7 +16901,7 @@ exports[`Locale Provider should display the text as bg 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -21933,7 +21933,7 @@ exports[`Locale Provider should display the text as ca 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle3"
@ -21942,7 +21942,7 @@ exports[`Locale Provider should display the text as ca 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -26974,7 +26974,7 @@ exports[`Locale Provider should display the text as cs 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle4"
@ -26983,7 +26983,7 @@ exports[`Locale Provider should display the text as cs 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -32015,7 +32015,7 @@ exports[`Locale Provider should display the text as da 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle5"
@ -32024,7 +32024,7 @@ exports[`Locale Provider should display the text as da 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -37056,7 +37056,7 @@ exports[`Locale Provider should display the text as de 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle6"
@ -37065,7 +37065,7 @@ exports[`Locale Provider should display the text as de 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -42097,7 +42097,7 @@ exports[`Locale Provider should display the text as el 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle7"
@ -42106,7 +42106,7 @@ exports[`Locale Provider should display the text as el 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -47138,7 +47138,7 @@ exports[`Locale Provider should display the text as en 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle9"
@ -47147,7 +47147,7 @@ exports[`Locale Provider should display the text as en 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -52179,7 +52179,7 @@ exports[`Locale Provider should display the text as en-gb 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle8"
@ -52188,7 +52188,7 @@ exports[`Locale Provider should display the text as en-gb 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -57220,7 +57220,7 @@ exports[`Locale Provider should display the text as es 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle10"
@ -57229,7 +57229,7 @@ exports[`Locale Provider should display the text as es 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -62261,7 +62261,7 @@ exports[`Locale Provider should display the text as et 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle11"
@ -62270,7 +62270,7 @@ exports[`Locale Provider should display the text as et 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -67302,7 +67302,7 @@ exports[`Locale Provider should display the text as fa 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle12"
@ -67311,7 +67311,7 @@ exports[`Locale Provider should display the text as fa 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -72343,7 +72343,7 @@ exports[`Locale Provider should display the text as fi 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle13"
@ -72352,7 +72352,7 @@ exports[`Locale Provider should display the text as fi 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -77384,7 +77384,7 @@ exports[`Locale Provider should display the text as fr 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle14"
@ -77393,7 +77393,7 @@ exports[`Locale Provider should display the text as fr 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -82425,7 +82425,7 @@ exports[`Locale Provider should display the text as fr 2`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle15"
@ -82434,7 +82434,7 @@ exports[`Locale Provider should display the text as fr 2`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -87466,7 +87466,7 @@ exports[`Locale Provider should display the text as ga 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle16"
@ -87475,7 +87475,7 @@ exports[`Locale Provider should display the text as ga 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -92507,7 +92507,7 @@ exports[`Locale Provider should display the text as gl 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle17"
@ -92516,7 +92516,7 @@ exports[`Locale Provider should display the text as gl 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -97548,7 +97548,7 @@ exports[`Locale Provider should display the text as he 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle18"
@ -97557,7 +97557,7 @@ exports[`Locale Provider should display the text as he 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -102589,7 +102589,7 @@ exports[`Locale Provider should display the text as hi 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle19"
@ -102598,7 +102598,7 @@ exports[`Locale Provider should display the text as hi 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -107630,7 +107630,7 @@ exports[`Locale Provider should display the text as hr 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle20"
@ -107639,7 +107639,7 @@ exports[`Locale Provider should display the text as hr 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -112671,7 +112671,7 @@ exports[`Locale Provider should display the text as hu 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle21"
@ -112680,7 +112680,7 @@ exports[`Locale Provider should display the text as hu 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -117712,7 +117712,7 @@ exports[`Locale Provider should display the text as hy-am 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle22"
@ -117721,7 +117721,7 @@ exports[`Locale Provider should display the text as hy-am 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -122753,7 +122753,7 @@ exports[`Locale Provider should display the text as id 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle52"
@ -122762,7 +122762,7 @@ exports[`Locale Provider should display the text as id 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -127794,7 +127794,7 @@ exports[`Locale Provider should display the text as is 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle23"
@ -127803,7 +127803,7 @@ exports[`Locale Provider should display the text as is 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -132835,7 +132835,7 @@ exports[`Locale Provider should display the text as it 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle24"
@ -132844,7 +132844,7 @@ exports[`Locale Provider should display the text as it 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -137876,7 +137876,7 @@ exports[`Locale Provider should display the text as ja 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle25"
@ -137885,7 +137885,7 @@ exports[`Locale Provider should display the text as ja 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -142917,7 +142917,7 @@ exports[`Locale Provider should display the text as kn 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle26"
@ -142926,7 +142926,7 @@ exports[`Locale Provider should display the text as kn 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -147958,7 +147958,7 @@ exports[`Locale Provider should display the text as ko 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle27"
@ -147967,7 +147967,7 @@ exports[`Locale Provider should display the text as ko 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -152999,7 +152999,7 @@ exports[`Locale Provider should display the text as ku 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle28"
@ -153008,7 +153008,7 @@ exports[`Locale Provider should display the text as ku 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -158040,7 +158040,7 @@ exports[`Locale Provider should display the text as ku-iq 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle29"
@ -158049,7 +158049,7 @@ exports[`Locale Provider should display the text as ku-iq 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -163081,7 +163081,7 @@ exports[`Locale Provider should display the text as lt 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle30"
@ -163090,7 +163090,7 @@ exports[`Locale Provider should display the text as lt 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -168122,7 +168122,7 @@ exports[`Locale Provider should display the text as lv 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle53"
@ -168131,7 +168131,7 @@ exports[`Locale Provider should display the text as lv 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -173163,7 +173163,7 @@ exports[`Locale Provider should display the text as mk 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle31"
@ -173172,7 +173172,7 @@ exports[`Locale Provider should display the text as mk 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -178204,7 +178204,7 @@ exports[`Locale Provider should display the text as mn-mn 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle33"
@ -178213,7 +178213,7 @@ exports[`Locale Provider should display the text as mn-mn 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -183245,7 +183245,7 @@ exports[`Locale Provider should display the text as ms-my 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle32"
@ -183254,7 +183254,7 @@ exports[`Locale Provider should display the text as ms-my 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -188286,7 +188286,7 @@ exports[`Locale Provider should display the text as nb 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle34"
@ -188295,7 +188295,7 @@ exports[`Locale Provider should display the text as nb 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -193327,7 +193327,7 @@ exports[`Locale Provider should display the text as ne-np 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle35"
@ -193336,7 +193336,7 @@ exports[`Locale Provider should display the text as ne-np 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -198368,7 +198368,7 @@ exports[`Locale Provider should display the text as nl 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle37"
@ -198377,7 +198377,7 @@ exports[`Locale Provider should display the text as nl 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -203409,7 +203409,7 @@ exports[`Locale Provider should display the text as nl-be 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle36"
@ -203418,7 +203418,7 @@ exports[`Locale Provider should display the text as nl-be 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -208450,7 +208450,7 @@ exports[`Locale Provider should display the text as pl 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle38"
@ -208459,7 +208459,7 @@ exports[`Locale Provider should display the text as pl 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -213491,7 +213491,7 @@ exports[`Locale Provider should display the text as pt 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle40"
@ -213500,7 +213500,7 @@ exports[`Locale Provider should display the text as pt 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -218532,7 +218532,7 @@ exports[`Locale Provider should display the text as pt-br 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle39"
@ -218541,7 +218541,7 @@ exports[`Locale Provider should display the text as pt-br 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -223573,7 +223573,7 @@ exports[`Locale Provider should display the text as ro 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle41"
@ -223582,7 +223582,7 @@ exports[`Locale Provider should display the text as ro 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -228614,7 +228614,7 @@ exports[`Locale Provider should display the text as ru 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle42"
@ -228623,7 +228623,7 @@ exports[`Locale Provider should display the text as ru 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -233655,7 +233655,7 @@ exports[`Locale Provider should display the text as sk 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle43"
@ -233664,7 +233664,7 @@ exports[`Locale Provider should display the text as sk 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -238696,7 +238696,7 @@ exports[`Locale Provider should display the text as sl 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle44"
@ -238705,7 +238705,7 @@ exports[`Locale Provider should display the text as sl 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -243737,7 +243737,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle45"
@ -243746,7 +243746,7 @@ exports[`Locale Provider should display the text as sr 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -248778,7 +248778,7 @@ exports[`Locale Provider should display the text as sv 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle46"
@ -248787,7 +248787,7 @@ exports[`Locale Provider should display the text as sv 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -253819,7 +253819,7 @@ exports[`Locale Provider should display the text as ta 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle47"
@ -253828,7 +253828,7 @@ exports[`Locale Provider should display the text as ta 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -258860,7 +258860,7 @@ exports[`Locale Provider should display the text as th 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle48"
@ -258869,7 +258869,7 @@ exports[`Locale Provider should display the text as th 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -263901,7 +263901,7 @@ exports[`Locale Provider should display the text as tr 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle49"
@ -263910,7 +263910,7 @@ exports[`Locale Provider should display the text as tr 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -268942,7 +268942,7 @@ exports[`Locale Provider should display the text as uk 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle50"
@ -268951,7 +268951,7 @@ exports[`Locale Provider should display the text as uk 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -273983,7 +273983,7 @@ exports[`Locale Provider should display the text as vi 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle51"
@ -273992,7 +273992,7 @@ exports[`Locale Provider should display the text as vi 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -279024,7 +279024,7 @@ exports[`Locale Provider should display the text as zh-cn 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle54"
@ -279033,7 +279033,7 @@ exports[`Locale Provider should display the text as zh-cn 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -284065,7 +284065,7 @@ exports[`Locale Provider should display the text as zh-hk 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle55"
@ -284074,7 +284074,7 @@ exports[`Locale Provider should display the text as zh-hk 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -289106,7 +289106,7 @@ exports[`Locale Provider should display the text as zh-tw 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
aria-labelledby="rcDialogTitle56"
@ -289115,7 +289115,7 @@ exports[`Locale Provider should display the text as zh-tw 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>

View File

@ -8,7 +8,7 @@ exports[`Modal render correctly 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
class="ant-modal-wrap"
@ -16,7 +16,7 @@ exports[`Modal render correctly 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -105,7 +105,7 @@ exports[`Modal render without footer 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
class="ant-modal-wrap"
@ -113,7 +113,7 @@ exports[`Modal render without footer 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>
@ -181,7 +181,7 @@ exports[`Modal support closeIcon 1`] = `
class="ant-modal-root"
>
<div
class="ant-modal-mask fade-appear"
class="ant-modal-mask fade-appear fade-appear-start fade"
/>
<div
class="ant-modal-wrap"
@ -189,7 +189,7 @@ exports[`Modal support closeIcon 1`] = `
tabindex="-1"
>
<div
class="ant-modal zoom-appear"
class="ant-modal zoom-appear zoom-appear-prepare zoom"
role="document"
style="width: 520px;"
>

View File

@ -1,12 +1,45 @@
import TestUtils from 'react-dom/test-utils';
import TestUtils, { act } from 'react-dom/test-utils';
import CSSMotion from 'rc-motion';
import { genCSSMotion } from 'rc-motion/lib/CSSMotion';
import KeyCode from 'rc-util/lib/KeyCode';
import Modal from '..';
import { destroyFns } from '../Modal';
import { sleep } from '../../../tests/utils';
const { confirm } = Modal;
jest.mock('rc-motion');
describe('Modal.confirm triggers callbacks correctly', () => {
// Inject CSSMotion to replace with No transition support
const MockCSSMotion = genCSSMotion(false);
Object.keys(MockCSSMotion).forEach(key => {
CSSMotion[key] = MockCSSMotion[key];
});
// Mock for rc-util raf
window.requestAnimationFrame = callback => {
return window.setTimeout(callback, 16);
};
window.cancelAnimationFrame = id => {
window.clearTimeout(id);
};
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
/* eslint-disable no-console */
// Hack error to remove act warning
const originError = console.error;
console.error = (...args) => {
const errorStr = String(args[0]);
if (errorStr.includes('was not wrapped in act(...)')) {
return;
}
originError(...args);
};
/* eslint-enable */
afterEach(() => {
errorSpy.mockReset();
document.body.innerHTML = '';
@ -68,20 +101,39 @@ describe('Modal.confirm triggers callbacks correctly', () => {
expect(onOk.mock.calls.length).toBe(1);
});
it('should allow Modal.comfirm without onCancel been set', () => {
it('should allow Modal.confirm without onCancel been set', () => {
open();
// Third Modal
$$('.ant-btn')[0].click();
expect(errorSpy).not.toHaveBeenCalled();
});
it('should allow Modal.comfirm without onOk been set', () => {
it('should allow Modal.confirm without onOk been set', () => {
open();
// Fourth Modal
$$('.ant-btn-primary')[0].click();
expect(errorSpy).not.toHaveBeenCalled();
});
it('should close confirm modal when press ESC', () => {
jest.useFakeTimers();
const onCancel = jest.fn();
Modal.confirm({
title: 'title',
content: 'content',
onCancel,
});
jest.runAllTimers();
expect($$(`.ant-modal-confirm-confirm`)).toHaveLength(1);
TestUtils.Simulate.keyDown($$('.ant-modal')[0], {
keyCode: KeyCode.ESC,
});
jest.runAllTimers();
expect($$(`.ant-modal-confirm-confirm`)).toHaveLength(0);
expect(onCancel).toHaveBeenCalledTimes(1);
jest.useRealTimers();
});
it('should not hide confirm when onOk return Promise.resolve', () => {
open({
onOk: () => Promise.resolve(''),
@ -90,23 +142,27 @@ describe('Modal.confirm triggers callbacks correctly', () => {
expect($$('.ant-modal-confirm')).toHaveLength(1);
});
it('should emit error when onOk return Promise.reject', () => {
it('should emit error when onOk return Promise.reject', async () => {
const error = new Error('something wrong');
open({
onOk: () => Promise.reject(error),
onOk: () => {
return Promise.reject(error);
},
});
$$('.ant-btn-primary')[0].click();
// wait promise
return Promise.resolve().then(() => {
await sleep();
expect(errorSpy).toHaveBeenCalledWith(error);
});
});
it('shows animation when close', () => {
open();
jest.useFakeTimers();
expect($$('.ant-modal-confirm')).toHaveLength(1);
$$('.ant-btn')[0].click();
jest.runAllTimers();
expect($$('.ant-modal-confirm')).toHaveLength(0);
jest.useRealTimers();
@ -158,25 +214,6 @@ describe('Modal.confirm triggers callbacks correctly', () => {
jest.useRealTimers();
});
it('should close confirm modal when press ESC', () => {
jest.useFakeTimers();
const onCancel = jest.fn();
Modal.confirm({
title: 'title',
content: 'content',
onCancel,
});
jest.runAllTimers();
expect($$(`.ant-modal-confirm-confirm`)).toHaveLength(1);
TestUtils.Simulate.keyDown($$('.ant-modal')[0], {
keyCode: 27,
});
jest.runAllTimers();
expect($$(`.ant-modal-confirm-confirm`)).toHaveLength(0);
expect(onCancel).toHaveBeenCalledTimes(1);
jest.useRealTimers();
});
it('should not close modals when click confirm button when onOk has argument', () => {
jest.useFakeTimers();
['info', 'success', 'warning', 'error'].forEach(type => {
@ -268,23 +305,35 @@ describe('Modal.confirm triggers callbacks correctly', () => {
it('destroyFns should reduce when instance.destroy', () => {
jest.useFakeTimers();
Modal.destroyAll(); // clear destroyFns
jest.runAllTimers();
const instances = [];
['info', 'success', 'warning', 'error'].forEach(type => {
const instance = Modal[type]({
title: 'title',
content: 'content',
});
// Render modal
act(() => {
jest.runAllTimers();
});
instances.push(instance);
});
const { length } = instances;
instances.forEach((instance, index) => {
expect(destroyFns.length).toBe(length - index);
act(() => {
instance.destroy();
jest.runAllTimers();
});
expect(destroyFns.length).toBe(length - index - 1);
});
jest.useRealTimers();
});

View File

@ -1,11 +1,20 @@
import React from 'react';
import CSSMotion from 'rc-motion';
import { genCSSMotion } from 'rc-motion/lib/CSSMotion';
import { mount } from 'enzyme';
import Modal from '..';
import Button from '../../button';
jest.mock('rc-util/lib/Portal');
jest.mock('rc-motion');
describe('Modal.hook', () => {
// Inject CSSMotion to replace with No transition support
const MockCSSMotion = genCSSMotion(false);
Object.keys(MockCSSMotion).forEach(key => {
CSSMotion[key] = MockCSSMotion[key];
});
it('hooks support context', () => {
jest.useFakeTimers();
const Context = React.createContext('light');

View File

@ -121,7 +121,7 @@
"rc-cascader": "~1.4.0",
"rc-checkbox": "~2.3.0",
"rc-collapse": "~2.0.0",
"rc-dialog": "~8.3.0",
"rc-dialog": "~8.4.0",
"rc-drawer": "~4.1.0",
"rc-dropdown": "~3.2.0",
"rc-field-form": "~1.12.0",