mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 00:20:04 +01:00
Update to Jest 25 (#18480)
* Revert "Revert "Upgrade to jest 25 (#17896)" (#18376)"
This reverts commit fc7835c657.
* Other fixes
* Fix a broken test
This commit is contained in:
parent
c083a643b1
commit
a8f2165e83
|
|
@ -11,7 +11,7 @@
|
|||
"classnames": "^2.2.5",
|
||||
"codemirror": "^5.40.0",
|
||||
"core-js": "^2.4.1",
|
||||
"jest-diff": "^24.8.0",
|
||||
"jest-diff": "^25.1.0",
|
||||
"prop-types": "^15.6.0",
|
||||
"query-string": "^4.2.3",
|
||||
"react": "^15.4.1",
|
||||
|
|
|
|||
|
|
@ -6,14 +6,20 @@
|
|||
version "7.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@babel/standalone/-/standalone-7.0.0.tgz#856446641620c1c5f0ca775621d478324ebd1f52"
|
||||
|
||||
"@jest/types@^24.8.0":
|
||||
version "24.8.0"
|
||||
resolved "https://registry.yarnpkg.com/@jest/types/-/types-24.8.0.tgz#f31e25948c58f0abd8c845ae26fcea1491dea7ad"
|
||||
integrity sha512-g17UxVr2YfBtaMUxn9u/4+siG1ptg9IGYAYwvpwn61nBg779RXnjE/m7CxYcIzEt0AbHZZAHSEZNhkE2WxURVg==
|
||||
"@jest/types@^25.1.0":
|
||||
version "25.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@jest/types/-/types-25.1.0.tgz#b26831916f0d7c381e11dbb5e103a72aed1b4395"
|
||||
integrity sha512-VpOtt7tCrgvamWZh1reVsGADujKigBUFTi19mlRjqEGsE8qH4r3s+skY33dNdXOwyZIvuftZ5tqdF1IgsMejMA==
|
||||
dependencies:
|
||||
"@types/istanbul-lib-coverage" "^2.0.0"
|
||||
"@types/istanbul-reports" "^1.1.1"
|
||||
"@types/yargs" "^12.0.9"
|
||||
"@types/yargs" "^15.0.0"
|
||||
chalk "^3.0.0"
|
||||
|
||||
"@types/color-name@^1.1.1":
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0"
|
||||
integrity sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==
|
||||
|
||||
"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0":
|
||||
version "2.0.1"
|
||||
|
|
@ -35,10 +41,17 @@
|
|||
"@types/istanbul-lib-coverage" "*"
|
||||
"@types/istanbul-lib-report" "*"
|
||||
|
||||
"@types/yargs@^12.0.9":
|
||||
version "12.0.12"
|
||||
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-12.0.12.tgz#45dd1d0638e8c8f153e87d296907659296873916"
|
||||
integrity sha512-SOhuU4wNBxhhTHxYaiG5NY4HBhDIDnJF60GU+2LqHAdKKer86//e4yg69aENCtQ04n0ovz+tq2YPME5t5yp4pw==
|
||||
"@types/yargs-parser@*":
|
||||
version "15.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-15.0.0.tgz#cb3f9f741869e20cce330ffbeb9271590483882d"
|
||||
integrity sha512-FA/BWv8t8ZWJ+gEOnLLd8ygxH/2UFbAvgEonyfN6yWGLKc7zVjbpl2Y4CTjid9h2RfgPP6SEt6uHwEOply00yw==
|
||||
|
||||
"@types/yargs@^15.0.0":
|
||||
version "15.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-15.0.1.tgz#9266a9d7be68cfcc982568211085a49a277f7c96"
|
||||
integrity sha512-sYlwNU7zYi6eZbMzFvG6eHD7VsEvFdoDtlD7eI1JTg7YNnuguzmiGsc6MPSq5l8n+h21AsNof0je+9sgOe4+dg==
|
||||
dependencies:
|
||||
"@types/yargs-parser" "*"
|
||||
|
||||
abab@^1.0.3:
|
||||
version "1.0.3"
|
||||
|
|
@ -174,10 +187,10 @@ ansi-regex@^3.0.0:
|
|||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998"
|
||||
|
||||
ansi-regex@^4.0.0:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997"
|
||||
integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==
|
||||
ansi-regex@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75"
|
||||
integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==
|
||||
|
||||
ansi-styles@^2.2.1:
|
||||
version "2.2.1"
|
||||
|
|
@ -189,12 +202,13 @@ ansi-styles@^3.0.0, ansi-styles@^3.1.0:
|
|||
dependencies:
|
||||
color-convert "^1.9.0"
|
||||
|
||||
ansi-styles@^3.2.0, ansi-styles@^3.2.1:
|
||||
version "3.2.1"
|
||||
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d"
|
||||
integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==
|
||||
ansi-styles@^4.0.0, ansi-styles@^4.1.0:
|
||||
version "4.2.1"
|
||||
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.2.1.tgz#90ae75c424d008d2624c5bf29ead3177ebfcf359"
|
||||
integrity sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==
|
||||
dependencies:
|
||||
color-convert "^1.9.0"
|
||||
"@types/color-name" "^1.1.1"
|
||||
color-convert "^2.0.1"
|
||||
|
||||
anymatch@^1.3.0:
|
||||
version "1.3.0"
|
||||
|
|
@ -1507,14 +1521,13 @@ chalk@^2.0.0, chalk@^2.1.0:
|
|||
escape-string-regexp "^1.0.5"
|
||||
supports-color "^4.0.0"
|
||||
|
||||
chalk@^2.0.1:
|
||||
version "2.4.2"
|
||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
|
||||
integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==
|
||||
chalk@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4"
|
||||
integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==
|
||||
dependencies:
|
||||
ansi-styles "^3.2.1"
|
||||
escape-string-regexp "^1.0.5"
|
||||
supports-color "^5.3.0"
|
||||
ansi-styles "^4.1.0"
|
||||
supports-color "^7.1.0"
|
||||
|
||||
chokidar@^1.6.0, chokidar@^1.7.0:
|
||||
version "1.7.0"
|
||||
|
|
@ -1626,10 +1639,22 @@ color-convert@^1.9.0:
|
|||
dependencies:
|
||||
color-name "^1.1.1"
|
||||
|
||||
color-convert@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3"
|
||||
integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==
|
||||
dependencies:
|
||||
color-name "~1.1.4"
|
||||
|
||||
color-name@^1.0.0, color-name@^1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.1.tgz#4b1415304cf50028ea81643643bd82ea05803689"
|
||||
|
||||
color-name@~1.1.4:
|
||||
version "1.1.4"
|
||||
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
|
||||
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
|
||||
|
||||
color-string@^0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/color-string/-/color-string-0.3.0.tgz#27d46fb67025c5c2fa25993bfbf579e47841b991"
|
||||
|
|
@ -2113,10 +2138,10 @@ detect-port-alt@1.1.3:
|
|||
address "^1.0.1"
|
||||
debug "^2.6.0"
|
||||
|
||||
diff-sequences@^24.3.0:
|
||||
version "24.3.0"
|
||||
resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.3.0.tgz#0f20e8a1df1abddaf4d9c226680952e64118b975"
|
||||
integrity sha512-xLqpez+Zj9GKSnPWS0WZw1igGocZ+uua8+y+5dDNTT934N3QuY1sp2LkHzwiaYQGz60hMq0pjAshdeXm5VUOEw==
|
||||
diff-sequences@^25.1.0:
|
||||
version "25.1.0"
|
||||
resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-25.1.0.tgz#fd29a46f1c913fd66c22645dc75bffbe43051f32"
|
||||
integrity sha512-nFIfVk5B/NStCsJ+zaPO4vYuLjlzQ6uFvPxzYyHlejNZ/UGa7G/n7peOXVrVNvRuyfstt+mZQYGpjxg9Z6N8Kw==
|
||||
|
||||
diff@^3.2.0:
|
||||
version "3.3.0"
|
||||
|
|
@ -3180,10 +3205,10 @@ has-flag@^2.0.0:
|
|||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51"
|
||||
|
||||
has-flag@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd"
|
||||
integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0=
|
||||
has-flag@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b"
|
||||
integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==
|
||||
|
||||
has-unicode@^2.0.0:
|
||||
version "2.0.1"
|
||||
|
|
@ -3836,15 +3861,15 @@ jest-diff@^20.0.3:
|
|||
jest-matcher-utils "^20.0.3"
|
||||
pretty-format "^20.0.3"
|
||||
|
||||
jest-diff@^24.8.0:
|
||||
version "24.8.0"
|
||||
resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.8.0.tgz#146435e7d1e3ffdf293d53ff97e193f1d1546172"
|
||||
integrity sha512-wxetCEl49zUpJ/bvUmIFjd/o52J+yWcoc5ZyPq4/W1LUKGEhRYDIbP1KcF6t+PvqNrGAFk4/JhtxDq/Nnzs66g==
|
||||
jest-diff@^25.1.0:
|
||||
version "25.1.0"
|
||||
resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-25.1.0.tgz#58b827e63edea1bc80c1de952b80cec9ac50e1ad"
|
||||
integrity sha512-nepXgajT+h017APJTreSieh4zCqnSHEJ1iT8HDlewu630lSJ4Kjjr9KNzm+kzGwwcpsDE6Snx1GJGzzsefaEHw==
|
||||
dependencies:
|
||||
chalk "^2.0.1"
|
||||
diff-sequences "^24.3.0"
|
||||
jest-get-type "^24.8.0"
|
||||
pretty-format "^24.8.0"
|
||||
chalk "^3.0.0"
|
||||
diff-sequences "^25.1.0"
|
||||
jest-get-type "^25.1.0"
|
||||
pretty-format "^25.1.0"
|
||||
|
||||
jest-docblock@^20.0.3:
|
||||
version "20.0.3"
|
||||
|
|
@ -3865,10 +3890,10 @@ jest-environment-node@^20.0.3:
|
|||
jest-mock "^20.0.3"
|
||||
jest-util "^20.0.3"
|
||||
|
||||
jest-get-type@^24.8.0:
|
||||
version "24.8.0"
|
||||
resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-24.8.0.tgz#a7440de30b651f5a70ea3ed7ff073a32dfe646fc"
|
||||
integrity sha512-RR4fo8jEmMD9zSz2nLbs2j0zvPpk/KCEz3a62jJWbd2ayNo0cb+KFRxPHVhE4ZmgGJEQp0fosmNz84IfqM8cMQ==
|
||||
jest-get-type@^25.1.0:
|
||||
version "25.1.0"
|
||||
resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-25.1.0.tgz#1cfe5fc34f148dc3a8a3b7275f6b9ce9e2e8a876"
|
||||
integrity sha512-yWkBnT+5tMr8ANB6V+OjmrIJufHtCAqI5ic2H40v+tRqxDmE0PGnIiTyvRWFOMtmVHYpwRqyazDbTnhpjsGvLw==
|
||||
|
||||
jest-haste-map@^20.0.4:
|
||||
version "20.0.5"
|
||||
|
|
@ -5335,15 +5360,15 @@ pretty-format@^20.0.3:
|
|||
ansi-regex "^2.1.1"
|
||||
ansi-styles "^3.0.0"
|
||||
|
||||
pretty-format@^24.8.0:
|
||||
version "24.8.0"
|
||||
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.8.0.tgz#8dae7044f58db7cb8be245383b565a963e3c27f2"
|
||||
integrity sha512-P952T7dkrDEplsR+TuY7q3VXDae5Sr7zmQb12JU/NDQa/3CH7/QW0yvqLcGN6jL+zQFKaoJcPc+yJxMTGmosqw==
|
||||
pretty-format@^25.1.0:
|
||||
version "25.1.0"
|
||||
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-25.1.0.tgz#ed869bdaec1356fc5ae45de045e2c8ec7b07b0c8"
|
||||
integrity sha512-46zLRSGLd02Rp+Lhad9zzuNZ+swunitn8zIpfD2B4OPCRLXbM87RJT2aBLBWYOznNUML/2l/ReMyWNC80PJBUQ==
|
||||
dependencies:
|
||||
"@jest/types" "^24.8.0"
|
||||
ansi-regex "^4.0.0"
|
||||
ansi-styles "^3.2.0"
|
||||
react-is "^16.8.4"
|
||||
"@jest/types" "^25.1.0"
|
||||
ansi-regex "^5.0.0"
|
||||
ansi-styles "^4.0.0"
|
||||
react-is "^16.12.0"
|
||||
|
||||
private@^0.1.6:
|
||||
version "0.1.6"
|
||||
|
|
@ -5531,10 +5556,10 @@ react-error-overlay@^1.0.10:
|
|||
settle-promise "1.0.0"
|
||||
source-map "0.5.6"
|
||||
|
||||
react-is@^16.8.4:
|
||||
version "16.8.6"
|
||||
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.6.tgz#5bbc1e2d29141c9fbdfed456343fe2bc430a6a16"
|
||||
integrity sha512-aUk3bHfZ2bRSVFFbbeVS4i+lNPZr3/WM5jT2J5omUVV1zzcs1nAaf3l51ctA5FFvCRbhrH0bdAsRRQddFJZPtA==
|
||||
react-is@^16.12.0:
|
||||
version "16.12.0"
|
||||
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.12.0.tgz#2cc0fe0fba742d97fd527c42a13bec4eeb06241c"
|
||||
integrity sha512-rPCkf/mWBtKc97aLL9/txD8DZdemK0vkA3JMLShjlJB3Pj3s+lpf1KaBzMfQrAmhMQB0n1cU/SUGgKKBCe837Q==
|
||||
|
||||
react-scripts@^1.0.11:
|
||||
version "1.0.11"
|
||||
|
|
@ -6354,12 +6379,12 @@ supports-color@^4.0.0, supports-color@^4.2.1:
|
|||
dependencies:
|
||||
has-flag "^2.0.0"
|
||||
|
||||
supports-color@^5.3.0:
|
||||
version "5.5.0"
|
||||
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f"
|
||||
integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==
|
||||
supports-color@^7.1.0:
|
||||
version "7.1.0"
|
||||
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.1.0.tgz#68e32591df73e25ad1c4b49108a2ec507962bfd1"
|
||||
integrity sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==
|
||||
dependencies:
|
||||
has-flag "^3.0.0"
|
||||
has-flag "^4.0.0"
|
||||
|
||||
svgo@^0.7.0:
|
||||
version "0.7.1"
|
||||
|
|
|
|||
|
|
@ -64,8 +64,8 @@
|
|||
"google-closure-compiler": "^20200224.0.0",
|
||||
"gzip-size": "^5.1.1",
|
||||
"jasmine-check": "^1.0.0-rc.0",
|
||||
"jest": "^24.9.0",
|
||||
"jest-diff": "^24.9.0",
|
||||
"jest": "^25.2.7",
|
||||
"jest-diff": "^25.2.6",
|
||||
"jest-snapshot-serializer-raw": "^1.1.0",
|
||||
"minimatch": "^3.0.4",
|
||||
"minimist": "^1.2.0",
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
},
|
||||
"homepage": "https://reactjs.org/",
|
||||
"peerDependencies": {
|
||||
"jest": "^23.0.1 || ^24.0.0",
|
||||
"jest": "^23.0.1 || ^24.0.0 || ^25.1.0",
|
||||
"scheduler": "^0.15.0"
|
||||
},
|
||||
"files": [
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
},
|
||||
"homepage": "https://reactjs.org/",
|
||||
"peerDependencies": {
|
||||
"jest": "^23.0.1 || ^24.0.0",
|
||||
"jest": "^23.0.1 || ^24.0.0 || ^25.1.0",
|
||||
"react": "^16.0.0",
|
||||
"react-test-renderer": "^16.0.0"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -245,13 +245,13 @@ describe('CSSPropertyOperations', () => {
|
|||
it('should not add units to CSS custom properties', () => {
|
||||
class Comp extends React.Component {
|
||||
render() {
|
||||
return <div style={{'--foo': 5}} />;
|
||||
return <div style={{'--foo': '5'}} />;
|
||||
}
|
||||
}
|
||||
|
||||
const root = document.createElement('div');
|
||||
ReactDOM.render(<Comp />, root);
|
||||
|
||||
expect(root.children[0].style.Foo).toEqual('5');
|
||||
expect(root.children[0].style.getPropertyValue('--foo')).toEqual('5');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2376,7 +2376,7 @@ describe('ReactDOMComponent', () => {
|
|||
const container = document.createElement('div');
|
||||
|
||||
ReactDOM.render(<img src={obj} />, container);
|
||||
expect(container.firstChild.src).toBe('hello');
|
||||
expect(container.firstChild.src).toBe('http://localhost/hello');
|
||||
|
||||
ReactDOM.render(<svg arabicForm={obj} />, container);
|
||||
expect(container.firstChild.getAttribute('arabic-form')).toBe('hello');
|
||||
|
|
@ -2410,7 +2410,7 @@ describe('ReactDOMComponent', () => {
|
|||
const child = Object.create(parent);
|
||||
const el = ReactTestUtils.renderIntoDocument(<img src={child} />);
|
||||
|
||||
expect(el.src).toBe('hello.jpg');
|
||||
expect(el.src).toBe('http://localhost/hello.jpg');
|
||||
});
|
||||
|
||||
it('assigns ajaxify (an important internal FB attribute)', function() {
|
||||
|
|
|
|||
|
|
@ -1547,8 +1547,7 @@ describe('ReactDOMInput', () => {
|
|||
);
|
||||
});
|
||||
|
||||
// FIXME: Re-enable this test when upgrading to Jest 25
|
||||
it.skip('sets type, step, min, max before value always', () => {
|
||||
it('sets type, step, min, max before value always', () => {
|
||||
const log = [];
|
||||
const originalCreateElement = document.createElement;
|
||||
spyOnDevAndProd(document, 'createElement').and.callFake(function(type) {
|
||||
|
|
@ -1584,26 +1583,13 @@ describe('ReactDOMInput', () => {
|
|||
container,
|
||||
);
|
||||
|
||||
if (disableInputAttributeSyncing) {
|
||||
expect(log).toEqual([
|
||||
'set attribute type',
|
||||
'set attribute min',
|
||||
'set attribute max',
|
||||
'set attribute step',
|
||||
'set property value',
|
||||
]);
|
||||
} else {
|
||||
expect(log).toEqual([
|
||||
'set attribute type',
|
||||
'set attribute min',
|
||||
'set attribute max',
|
||||
'set attribute step',
|
||||
'set property value',
|
||||
'set attribute value',
|
||||
// FIXME: This doesn't get logged in prod build??
|
||||
'set attribute checked',
|
||||
]);
|
||||
}
|
||||
expect(log).toEqual([
|
||||
'set attribute type',
|
||||
'set attribute min',
|
||||
'set attribute max',
|
||||
'set attribute step',
|
||||
'set property value',
|
||||
]);
|
||||
});
|
||||
|
||||
it('sets value properly with type coming later in props', () => {
|
||||
|
|
@ -1630,8 +1616,7 @@ describe('ReactDOMInput', () => {
|
|||
expect(node.value).toEqual('Test');
|
||||
});
|
||||
|
||||
// FIXME: Re-enable this test when upgrading to Jest 25
|
||||
it.skip('resets value of date/time input to fix bugs in iOS Safari', () => {
|
||||
it('resets value of date/time input to fix bugs in iOS Safari', () => {
|
||||
function strify(x) {
|
||||
return JSON.stringify(x, null, 2);
|
||||
}
|
||||
|
|
@ -1640,15 +1625,39 @@ describe('ReactDOMInput', () => {
|
|||
const originalCreateElement = document.createElement;
|
||||
spyOnDevAndProd(document, 'createElement').and.callFake(function(type) {
|
||||
const el = originalCreateElement.apply(this, arguments);
|
||||
let value = '';
|
||||
const getDefaultValue = Object.getOwnPropertyDescriptor(
|
||||
HTMLInputElement.prototype,
|
||||
'defaultValue',
|
||||
).get;
|
||||
const setDefaultValue = Object.getOwnPropertyDescriptor(
|
||||
HTMLInputElement.prototype,
|
||||
'defaultValue',
|
||||
).set;
|
||||
const getValue = Object.getOwnPropertyDescriptor(
|
||||
HTMLInputElement.prototype,
|
||||
'value',
|
||||
).get;
|
||||
const setValue = Object.getOwnPropertyDescriptor(
|
||||
HTMLInputElement.prototype,
|
||||
'value',
|
||||
).set;
|
||||
if (type === 'input') {
|
||||
Object.defineProperty(el, 'value', {
|
||||
Object.defineProperty(el, 'defaultValue', {
|
||||
get: function() {
|
||||
return value;
|
||||
return getDefaultValue.call(this);
|
||||
},
|
||||
set: function(val) {
|
||||
log.push(`node.defaultValue = ${strify(val)}`);
|
||||
setDefaultValue.call(this, val);
|
||||
},
|
||||
});
|
||||
Object.defineProperty(el, 'value', {
|
||||
get: function() {
|
||||
return getValue.call(this);
|
||||
},
|
||||
set: function(val) {
|
||||
value = '' + val;
|
||||
log.push(`node.value = ${strify(val)}`);
|
||||
setValue.call(this, val);
|
||||
},
|
||||
});
|
||||
spyOnDevAndProd(el, 'setAttribute').and.callFake(function(name, val) {
|
||||
|
|
@ -1663,15 +1672,18 @@ describe('ReactDOMInput', () => {
|
|||
if (disableInputAttributeSyncing) {
|
||||
expect(log).toEqual([
|
||||
'node.setAttribute("type", "date")',
|
||||
'node.setAttribute("value", "1980-01-01")',
|
||||
'node.defaultValue = "1980-01-01"',
|
||||
// TODO: it's possible this reintroduces the bug because we don't assign `value` at all.
|
||||
// Need to check this on mobile Safari and Chrome.
|
||||
]);
|
||||
} else {
|
||||
expect(log).toEqual([
|
||||
'node.setAttribute("type", "date")',
|
||||
// value must be assigned before defaultValue. This fixes an issue where the
|
||||
// visually displayed value of date inputs disappears on mobile Safari and Chrome:
|
||||
// https://github.com/facebook/react/issues/7233
|
||||
'node.value = "1980-01-01"',
|
||||
'node.setAttribute("value", "1980-01-01")',
|
||||
// FIXME: This doesn't get logged in prod build??
|
||||
'node.setAttribute("checked", "")',
|
||||
'node.defaultValue = "1980-01-01"',
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -377,14 +377,7 @@ describe('ReactDOMSelect', () => {
|
|||
expect(select.options[1].selected).toBe(false);
|
||||
expect(select.options[2].selected).toBe(false);
|
||||
|
||||
// Note: There is an inconsistency between JSDOM and Chrome where
|
||||
// Chrome reports an empty string when no value is selected for a
|
||||
// single-select with a size greater than 0. JSDOM reports the first
|
||||
// value
|
||||
//
|
||||
// This assertion exists only for clarity of JSDOM behavior:
|
||||
expect(select.value).toBe('monkey'); // "" in Chrome
|
||||
// Despite this, the selection index is correct:
|
||||
expect(select.value).toBe('');
|
||||
expect(select.selectedIndex).toBe(-1);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -396,14 +396,12 @@ describe('ReactDOMServerIntegration', () => {
|
|||
|
||||
itRenders('custom properties', async render => {
|
||||
const e = await render(<div style={{'--foo': 5}} />);
|
||||
// This seems like an odd way computed properties are exposed in jsdom.
|
||||
// In a real browser we'd read it with e.style.getPropertyValue('--foo')
|
||||
expect(e.style.Foo).toBe('5');
|
||||
expect(e.style.getPropertyValue('--foo')).toBe('5');
|
||||
});
|
||||
|
||||
itRenders('camel cased custom properties', async render => {
|
||||
const e = await render(<div style={{'--someColor': '#000000'}} />);
|
||||
expect(e.style.SomeColor).toBe('#000000');
|
||||
expect(e.style.getPropertyValue('--someColor')).toBe('#000000');
|
||||
});
|
||||
|
||||
itRenders('no undefined styles', async render => {
|
||||
|
|
@ -432,36 +430,40 @@ describe('ReactDOMServerIntegration', () => {
|
|||
<div
|
||||
style={{
|
||||
lineClamp: 10,
|
||||
WebkitLineClamp: 10,
|
||||
MozFlexGrow: 10,
|
||||
msFlexGrow: 10,
|
||||
msGridRow: 10,
|
||||
msGridRowEnd: 10,
|
||||
msGridRowSpan: 10,
|
||||
msGridRowStart: 10,
|
||||
msGridColumn: 10,
|
||||
msGridColumnEnd: 10,
|
||||
msGridColumnSpan: 10,
|
||||
msGridColumnStart: 10,
|
||||
// TODO: requires https://github.com/jsdom/cssstyle/pull/112
|
||||
// WebkitLineClamp: 10,
|
||||
// TODO: revisit once cssstyle or jsdom figures out
|
||||
// if they want to support other vendors or not
|
||||
// MozFlexGrow: 10,
|
||||
// msFlexGrow: 10,
|
||||
// msGridRow: 10,
|
||||
// msGridRowEnd: 10,
|
||||
// msGridRowSpan: 10,
|
||||
// msGridRowStart: 10,
|
||||
// msGridColumn: 10,
|
||||
// msGridColumnEnd: 10,
|
||||
// msGridColumnSpan: 10,
|
||||
// msGridColumnStart: 10,
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(style.lineClamp).toBe('10');
|
||||
expect(style.WebkitLineClamp).toBe('10');
|
||||
expect(style.MozFlexGrow).toBe('10');
|
||||
// see comment at inline styles above
|
||||
// expect(style.WebkitLineClamp).toBe('10');
|
||||
// expect(style.MozFlexGrow).toBe('10');
|
||||
// jsdom is inconsistent in the style property name
|
||||
// it uses on the client and when processing server markup.
|
||||
// But it should be there either way.
|
||||
expect(style.MsFlexGrow || style.msFlexGrow).toBe('10');
|
||||
expect(style.MsGridRow || style.msGridRow).toBe('10');
|
||||
expect(style.MsGridRowEnd || style.msGridRowEnd).toBe('10');
|
||||
expect(style.MsGridRowSpan || style.msGridRowSpan).toBe('10');
|
||||
expect(style.MsGridRowStart || style.msGridRowStart).toBe('10');
|
||||
expect(style.MsGridColumn || style.msGridColumn).toBe('10');
|
||||
expect(style.MsGridColumnEnd || style.msGridColumnEnd).toBe('10');
|
||||
expect(style.MsGridColumnSpan || style.msGridColumnSpan).toBe('10');
|
||||
expect(style.MsGridColumnStart || style.msGridColumnStart).toBe('10');
|
||||
//expect(style.MsFlexGrow || style.msFlexGrow).toBe('10');
|
||||
// expect(style.MsGridRow || style.msGridRow).toBe('10');
|
||||
// expect(style.MsGridRowEnd || style.msGridRowEnd).toBe('10');
|
||||
// expect(style.MsGridRowSpan || style.msGridRowSpan).toBe('10');
|
||||
// expect(style.MsGridRowStart || style.msGridRowStart).toBe('10');
|
||||
// expect(style.MsGridColumn || style.msGridColumn).toBe('10');
|
||||
// expect(style.MsGridColumnEnd || style.msGridColumnEnd).toBe('10');
|
||||
// expect(style.MsGridColumnSpan || style.msGridColumnSpan).toBe('10');
|
||||
// expect(style.MsGridColumnStart || style.msGridColumnStart).toBe('10');
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ describe('ReactDOMServerIntegrationUserInteraction', () => {
|
|||
expect(e.checked).toBe(true);
|
||||
|
||||
// simulate a user clicking.
|
||||
e.dispatchEvent(new Event('click', {bubbles: true, cancelable: true}));
|
||||
e.click();
|
||||
|
||||
expect(changeCount).toBe(1);
|
||||
expect(e.checked).toBe(false);
|
||||
|
|
|
|||
|
|
@ -250,9 +250,7 @@ describe('ChangeEventPlugin', () => {
|
|||
input.checked = true;
|
||||
// Under the hood, uncheck the box so that the click will "check" it again.
|
||||
setUntrackedChecked.call(input, false);
|
||||
input.dispatchEvent(
|
||||
new MouseEvent('click', {bubbles: true, cancelable: true}),
|
||||
);
|
||||
input.click();
|
||||
expect(input.checked).toBe(true);
|
||||
// We don't expect a React event because at the time of the click, the real
|
||||
// checked value (true) was the same as the last recorded "current" value
|
||||
|
|
@ -261,7 +259,7 @@ describe('ChangeEventPlugin', () => {
|
|||
|
||||
// However, simulating a normal click should fire a React event because the
|
||||
// real value (false) would have changed from the last tracked value (true).
|
||||
input.dispatchEvent(new Event('click', {bubbles: true, cancelable: true}));
|
||||
input.click();
|
||||
expect(called).toBe(1);
|
||||
});
|
||||
|
||||
|
|
@ -315,24 +313,18 @@ describe('ChangeEventPlugin', () => {
|
|||
const option2 = div.childNodes[1];
|
||||
|
||||
// Select first option.
|
||||
option1.dispatchEvent(
|
||||
new Event('click', {bubbles: true, cancelable: true}),
|
||||
);
|
||||
option1.click();
|
||||
expect(called1).toBe(1);
|
||||
expect(called2).toBe(0);
|
||||
|
||||
// Select second option.
|
||||
option2.dispatchEvent(
|
||||
new Event('click', {bubbles: true, cancelable: true}),
|
||||
);
|
||||
option2.click();
|
||||
expect(called1).toBe(1);
|
||||
expect(called2).toBe(1);
|
||||
|
||||
// Select the first option.
|
||||
// It should receive the React change event again.
|
||||
option1.dispatchEvent(
|
||||
new Event('click', {bubbles: true, cancelable: true}),
|
||||
);
|
||||
option1.click();
|
||||
expect(called1).toBe(2);
|
||||
expect(called2).toBe(1);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -182,11 +182,10 @@ describe('DOMEventResponderSystem', () => {
|
|||
dispatchClickEvent(buttonElement);
|
||||
expect(eventResponderFiredCount).toBe(1);
|
||||
expect(eventLog.length).toBe(1);
|
||||
// JSDOM does not support passive events, so this will be false
|
||||
expect(eventLog).toEqual([
|
||||
{
|
||||
name: 'click',
|
||||
passive: false,
|
||||
passive: true,
|
||||
phase: 'bubble',
|
||||
},
|
||||
]);
|
||||
|
|
@ -289,11 +288,10 @@ describe('DOMEventResponderSystem', () => {
|
|||
dispatchClickEvent(buttonElement);
|
||||
expect(eventResponderFiredCount).toBe(1);
|
||||
expect(eventLog.length).toBe(1);
|
||||
// JSDOM does not support passive events, so this will be false
|
||||
expect(eventLog).toEqual([
|
||||
{
|
||||
name: 'click',
|
||||
passive: false,
|
||||
passive: true,
|
||||
phase: 'bubble',
|
||||
},
|
||||
]);
|
||||
|
|
@ -323,7 +321,7 @@ describe('DOMEventResponderSystem', () => {
|
|||
expect(eventLog).toEqual([
|
||||
{
|
||||
name: 'click',
|
||||
passive: false,
|
||||
passive: true,
|
||||
phase: 'bubble',
|
||||
},
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ describe('SelectEventPlugin', () => {
|
|||
<input type="text" onMouseDown={function() {}} />,
|
||||
container,
|
||||
);
|
||||
node.focus();
|
||||
|
||||
// Trigger `mousedown` and `mouseup`. Note that
|
||||
// React is not currently listening to `mouseup`.
|
||||
|
|
|
|||
|
|
@ -436,9 +436,7 @@ describe('Input event responder', () => {
|
|||
|
||||
// However, simulating a normal click should fire a React event because the
|
||||
// real value (false) would have changed from the last tracked value (true).
|
||||
ref.current.dispatchEvent(
|
||||
new Event('click', {bubbles: true, cancelable: true}),
|
||||
);
|
||||
ref.current.click();
|
||||
expect(onChangeCalled).toBe(1);
|
||||
expect(onValueChangeCalled).toBe(1);
|
||||
});
|
||||
|
|
@ -546,18 +544,14 @@ describe('Input event responder', () => {
|
|||
const option2 = ref.current.childNodes[1];
|
||||
|
||||
// Select first option.
|
||||
option1.dispatchEvent(
|
||||
new Event('click', {bubbles: true, cancelable: true}),
|
||||
);
|
||||
option1.click();
|
||||
expect(onChangeCalled1).toBe(1);
|
||||
expect(onValueChangeCalled1).toBe(1);
|
||||
expect(onChangeCalled2).toBe(0);
|
||||
expect(onValueChangeCalled2).toBe(0);
|
||||
|
||||
// Select second option.
|
||||
option2.dispatchEvent(
|
||||
new Event('click', {bubbles: true, cancelable: true}),
|
||||
);
|
||||
option2.click();
|
||||
expect(onChangeCalled1).toBe(1);
|
||||
expect(onValueChangeCalled1).toBe(1);
|
||||
expect(onChangeCalled2).toBe(1);
|
||||
|
|
@ -565,9 +559,7 @@ describe('Input event responder', () => {
|
|||
|
||||
// Select the first option.
|
||||
// It should receive the React change event again.
|
||||
option1.dispatchEvent(
|
||||
new Event('click', {bubbles: true, cancelable: true}),
|
||||
);
|
||||
option1.click();
|
||||
expect(onChangeCalled1).toBe(2);
|
||||
expect(onValueChangeCalled1).toBe(2);
|
||||
expect(onChangeCalled2).toBe(1);
|
||||
|
|
|
|||
|
|
@ -21,11 +21,4 @@ module.exports = {
|
|||
collectCoverageFrom: ['packages/**/*.js'],
|
||||
timers: 'fake',
|
||||
snapshotSerializers: [require.resolve('jest-snapshot-serializer-raw')],
|
||||
// Jest changed from `about:blank` to `http://localhost` default in 24.5 (https://github.com/facebook/jest/pull/6792)
|
||||
// in order to address https://github.com/facebook/jest/issues/6766. If one uses `about:blank` in JSDOM@11.12 or
|
||||
// newer, it fails with `SecurityError: localStorage is not available for opaque origins`. However, some of React's
|
||||
// tests depend on `about:blank` being the domain (for e.g. `url` in `img` tags). So we set `about:blank` here to
|
||||
// keep the current behavior and make sure to keep the version of JSDOM to version lower than 11.12. This will have
|
||||
// to be addressed properly when Jest 25 is released, as it will come with a newer version of JSDOM.
|
||||
testURL: 'about:blank',
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
const jestDiff = require('jest-diff');
|
||||
const jestDiff = require('jest-diff').default;
|
||||
|
||||
function toContainNoInteractions(actualSet) {
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
const jestDiff = require('jest-diff');
|
||||
const jestDiff = require('jest-diff').default;
|
||||
|
||||
function toHaveLastRenderedWithNoInteractions(onRenderMockFn) {
|
||||
const calls = onRenderMockFn.mock.calls;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
const jestDiff = require('jest-diff');
|
||||
const jestDiff = require('jest-diff').default;
|
||||
const util = require('util');
|
||||
const shouldIgnoreConsoleError = require('../shouldIgnoreConsoleError');
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user