mirror of
https://github.com/apache/superset.git
synced 2024-09-06 13:57:40 -04:00
test: Switching FlashProvider to function component & creating tests (#13220)
This commit is contained in:
parent
99a0c8a8a1
commit
6297ad7c8b
147
superset-frontend/package-lock.json
generated
147
superset-frontend/package-lock.json
generated
@ -149,6 +149,7 @@
|
|||||||
"@testing-library/dom": "^7.29.4",
|
"@testing-library/dom": "^7.29.4",
|
||||||
"@testing-library/jest-dom": "^5.11.6",
|
"@testing-library/jest-dom": "^5.11.6",
|
||||||
"@testing-library/react": "^11.2.0",
|
"@testing-library/react": "^11.2.0",
|
||||||
|
"@testing-library/react-hooks": "^5.0.3",
|
||||||
"@testing-library/user-event": "^12.7.0",
|
"@testing-library/user-event": "^12.7.0",
|
||||||
"@types/classnames": "^2.2.10",
|
"@types/classnames": "^2.2.10",
|
||||||
"@types/dom-to-image": "^2.6.0",
|
"@types/dom-to-image": "^2.6.0",
|
||||||
@ -302,6 +303,8 @@
|
|||||||
"integrity": "sha512-+y4ZnePpvWs1fc/LhZRTHkTesbXkyBYuOB+5CyodZqrEuETXi3zOVfpAQIdgC3lXbHLTDG9dQosxR9BhvLKDLQ==",
|
"integrity": "sha512-+y4ZnePpvWs1fc/LhZRTHkTesbXkyBYuOB+5CyodZqrEuETXi3zOVfpAQIdgC3lXbHLTDG9dQosxR9BhvLKDLQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@nicolo-ribaudo/chokidar-2": "2.1.8-no-fsevents",
|
||||||
|
"chokidar": "^3.4.0",
|
||||||
"commander": "^4.0.1",
|
"commander": "^4.0.1",
|
||||||
"convert-source-map": "^1.1.0",
|
"convert-source-map": "^1.1.0",
|
||||||
"fs-readdir-recursive": "^1.1.0",
|
"fs-readdir-recursive": "^1.1.0",
|
||||||
@ -7107,6 +7110,7 @@
|
|||||||
"@types/node": "*",
|
"@types/node": "*",
|
||||||
"anymatch": "^3.0.3",
|
"anymatch": "^3.0.3",
|
||||||
"fb-watchman": "^2.0.0",
|
"fb-watchman": "^2.0.0",
|
||||||
|
"fsevents": "^2.1.2",
|
||||||
"graceful-fs": "^4.2.4",
|
"graceful-fs": "^4.2.4",
|
||||||
"jest-regex-util": "^26.0.0",
|
"jest-regex-util": "^26.0.0",
|
||||||
"jest-serializer": "^26.6.2",
|
"jest-serializer": "^26.6.2",
|
||||||
@ -7710,6 +7714,7 @@
|
|||||||
"jest-resolve": "^26.6.2",
|
"jest-resolve": "^26.6.2",
|
||||||
"jest-util": "^26.6.2",
|
"jest-util": "^26.6.2",
|
||||||
"jest-worker": "^26.6.2",
|
"jest-worker": "^26.6.2",
|
||||||
|
"node-notifier": "^8.0.0",
|
||||||
"slash": "^3.0.0",
|
"slash": "^3.0.0",
|
||||||
"source-map": "^0.6.0",
|
"source-map": "^0.6.0",
|
||||||
"string-length": "^4.0.1",
|
"string-length": "^4.0.1",
|
||||||
@ -7898,6 +7903,7 @@
|
|||||||
"@types/node": "*",
|
"@types/node": "*",
|
||||||
"anymatch": "^3.0.3",
|
"anymatch": "^3.0.3",
|
||||||
"fb-watchman": "^2.0.0",
|
"fb-watchman": "^2.0.0",
|
||||||
|
"fsevents": "^2.1.2",
|
||||||
"graceful-fs": "^4.2.4",
|
"graceful-fs": "^4.2.4",
|
||||||
"jest-regex-util": "^26.0.0",
|
"jest-regex-util": "^26.0.0",
|
||||||
"jest-serializer": "^26.6.2",
|
"jest-serializer": "^26.6.2",
|
||||||
@ -8329,6 +8335,7 @@
|
|||||||
"@types/node": "*",
|
"@types/node": "*",
|
||||||
"anymatch": "^3.0.3",
|
"anymatch": "^3.0.3",
|
||||||
"fb-watchman": "^2.0.0",
|
"fb-watchman": "^2.0.0",
|
||||||
|
"fsevents": "^2.1.2",
|
||||||
"graceful-fs": "^4.2.4",
|
"graceful-fs": "^4.2.4",
|
||||||
"jest-regex-util": "^26.0.0",
|
"jest-regex-util": "^26.0.0",
|
||||||
"jest-serializer": "^26.6.2",
|
"jest-serializer": "^26.6.2",
|
||||||
@ -10115,7 +10122,8 @@
|
|||||||
"esprima": "^4.0.1",
|
"esprima": "^4.0.1",
|
||||||
"estraverse": "^4.2.0",
|
"estraverse": "^4.2.0",
|
||||||
"esutils": "^2.0.2",
|
"esutils": "^2.0.2",
|
||||||
"optionator": "^0.8.1"
|
"optionator": "^0.8.1",
|
||||||
|
"source-map": "~0.6.1"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"escodegen": "bin/escodegen.js",
|
"escodegen": "bin/escodegen.js",
|
||||||
@ -10797,6 +10805,9 @@
|
|||||||
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.22.0.tgz",
|
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.22.0.tgz",
|
||||||
"integrity": "sha512-lLJ/Wt9yy0AiSYBf212kK3mM5L8ycwlyTlSxHBAneXLR0nzFMlZ5y7riFPF3E33zXOF2IH95xdY5jIyZbM9z/w==",
|
"integrity": "sha512-lLJ/Wt9yy0AiSYBf212kK3mM5L8ycwlyTlSxHBAneXLR0nzFMlZ5y7riFPF3E33zXOF2IH95xdY5jIyZbM9z/w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"clipboard": "^2.0.0"
|
||||||
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"clipboard": "^2.0.0"
|
"clipboard": "^2.0.0"
|
||||||
}
|
}
|
||||||
@ -16402,6 +16413,49 @@
|
|||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@testing-library/react-hooks": {
|
||||||
|
"version": "5.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@testing-library/react-hooks/-/react-hooks-5.0.3.tgz",
|
||||||
|
"integrity": "sha512-UrnnRc5II7LMH14xsYNm/WRch/67cBafmrSQcyFh0v+UUmSf1uzfB7zn5jQXSettGwOSxJwdQUN7PgkT0w22Lg==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@babel/runtime": "^7.12.5",
|
||||||
|
"@types/react": ">=16.9.0",
|
||||||
|
"@types/react-dom": ">=16.9.0",
|
||||||
|
"@types/react-test-renderer": ">=16.9.0",
|
||||||
|
"filter-console": "^0.1.1",
|
||||||
|
"react-error-boundary": "^3.1.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": ">=16.9.0",
|
||||||
|
"react-dom": ">=16.9.0",
|
||||||
|
"react-test-renderer": ">=16.9.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"react-dom": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"react-test-renderer": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@testing-library/react-hooks/node_modules/react-error-boundary": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-error-boundary/-/react-error-boundary-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-lmPrdi5SLRJR+AeJkqdkGlW/CRkAUvZnETahK58J4xb5wpbfDngasEGu+w0T1iXEhVrYBJZeW+c4V1hILCnMWQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@babel/runtime": "^7.12.5"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10",
|
||||||
|
"npm": ">=6"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": ">=16.13.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@testing-library/user-event": {
|
"node_modules/@testing-library/user-event": {
|
||||||
"version": "12.7.0",
|
"version": "12.7.0",
|
||||||
"resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-12.7.0.tgz",
|
"resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-12.7.0.tgz",
|
||||||
@ -17049,6 +17103,15 @@
|
|||||||
"@types/react": "*"
|
"@types/react": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/react-test-renderer": {
|
||||||
|
"version": "17.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/react-test-renderer/-/react-test-renderer-17.0.1.tgz",
|
||||||
|
"integrity": "sha512-3Fi2O6Zzq/f3QR9dRnlnHso9bMl7weKCviFmfF6B4LS1Uat6Hkm15k0ZAQuDz+UBq6B3+g+NM6IT2nr5QgPzCw==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@types/react": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@types/react-transition-group": {
|
"node_modules/@types/react-transition-group": {
|
||||||
"version": "4.4.0",
|
"version": "4.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.0.tgz",
|
||||||
@ -20129,6 +20192,7 @@
|
|||||||
"@types/node": "*",
|
"@types/node": "*",
|
||||||
"anymatch": "^3.0.3",
|
"anymatch": "^3.0.3",
|
||||||
"fb-watchman": "^2.0.0",
|
"fb-watchman": "^2.0.0",
|
||||||
|
"fsevents": "^2.1.2",
|
||||||
"graceful-fs": "^4.2.4",
|
"graceful-fs": "^4.2.4",
|
||||||
"jest-regex-util": "^26.0.0",
|
"jest-regex-util": "^26.0.0",
|
||||||
"jest-serializer": "^26.6.2",
|
"jest-serializer": "^26.6.2",
|
||||||
@ -21947,6 +22011,7 @@
|
|||||||
"anymatch": "^2.0.0",
|
"anymatch": "^2.0.0",
|
||||||
"async-each": "^1.0.0",
|
"async-each": "^1.0.0",
|
||||||
"braces": "^2.3.0",
|
"braces": "^2.3.0",
|
||||||
|
"fsevents": "^1.2.2",
|
||||||
"glob-parent": "^3.1.0",
|
"glob-parent": "^3.1.0",
|
||||||
"inherits": "^2.0.1",
|
"inherits": "^2.0.1",
|
||||||
"is-binary-path": "^1.0.0",
|
"is-binary-path": "^1.0.0",
|
||||||
@ -22708,6 +22773,7 @@
|
|||||||
"integrity": "sha512-gnB85c3MGC7Nm9I/FkiasNBOKjOiO1RNuXXarQms37q4QMpWdlbBgD/VnOStA2faG1dpXMv31RFApjX1/QdgWQ==",
|
"integrity": "sha512-gnB85c3MGC7Nm9I/FkiasNBOKjOiO1RNuXXarQms37q4QMpWdlbBgD/VnOStA2faG1dpXMv31RFApjX1/QdgWQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"colors": "^1.1.2",
|
||||||
"object-assign": "^4.1.0",
|
"object-assign": "^4.1.0",
|
||||||
"string-width": "^4.2.0"
|
"string-width": "^4.2.0"
|
||||||
},
|
},
|
||||||
@ -26338,7 +26404,8 @@
|
|||||||
"esprima": "^3.1.3",
|
"esprima": "^3.1.3",
|
||||||
"estraverse": "^4.2.0",
|
"estraverse": "^4.2.0",
|
||||||
"esutils": "^2.0.2",
|
"esutils": "^2.0.2",
|
||||||
"optionator": "^0.8.1"
|
"optionator": "^0.8.1",
|
||||||
|
"source-map": "~0.6.1"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"escodegen": "bin/escodegen.js",
|
"escodegen": "bin/escodegen.js",
|
||||||
@ -28921,6 +28988,15 @@
|
|||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/filter-console": {
|
||||||
|
"version": "0.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/filter-console/-/filter-console-0.1.1.tgz",
|
||||||
|
"integrity": "sha512-zrXoV1Uaz52DqPs+qEwNJWJFAWZpYJ47UNmpN9q4j+/EYsz85uV0DC9k8tRND5kYmoVzL0W+Y75q4Rg8sRJCdg==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/finalhandler": {
|
"node_modules/finalhandler": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz",
|
||||||
@ -32440,6 +32516,7 @@
|
|||||||
"@types/node": "*",
|
"@types/node": "*",
|
||||||
"anymatch": "^3.0.3",
|
"anymatch": "^3.0.3",
|
||||||
"fb-watchman": "^2.0.0",
|
"fb-watchman": "^2.0.0",
|
||||||
|
"fsevents": "^2.1.2",
|
||||||
"graceful-fs": "^4.2.4",
|
"graceful-fs": "^4.2.4",
|
||||||
"jest-regex-util": "^26.0.0",
|
"jest-regex-util": "^26.0.0",
|
||||||
"jest-serializer": "^26.6.2",
|
"jest-serializer": "^26.6.2",
|
||||||
@ -33279,6 +33356,7 @@
|
|||||||
"@jest/types": "^24.9.0",
|
"@jest/types": "^24.9.0",
|
||||||
"anymatch": "^2.0.0",
|
"anymatch": "^2.0.0",
|
||||||
"fb-watchman": "^2.0.0",
|
"fb-watchman": "^2.0.0",
|
||||||
|
"fsevents": "^1.2.7",
|
||||||
"graceful-fs": "^4.1.15",
|
"graceful-fs": "^4.1.15",
|
||||||
"invariant": "^2.2.4",
|
"invariant": "^2.2.4",
|
||||||
"jest-serializer": "^24.9.0",
|
"jest-serializer": "^24.9.0",
|
||||||
@ -34052,6 +34130,7 @@
|
|||||||
"@types/node": "*",
|
"@types/node": "*",
|
||||||
"anymatch": "^3.0.3",
|
"anymatch": "^3.0.3",
|
||||||
"fb-watchman": "^2.0.0",
|
"fb-watchman": "^2.0.0",
|
||||||
|
"fsevents": "^2.1.2",
|
||||||
"graceful-fs": "^4.2.4",
|
"graceful-fs": "^4.2.4",
|
||||||
"jest-regex-util": "^26.0.0",
|
"jest-regex-util": "^26.0.0",
|
||||||
"jest-serializer": "^26.6.2",
|
"jest-serializer": "^26.6.2",
|
||||||
@ -35698,6 +35777,7 @@
|
|||||||
"@types/node": "*",
|
"@types/node": "*",
|
||||||
"anymatch": "^3.0.3",
|
"anymatch": "^3.0.3",
|
||||||
"fb-watchman": "^2.0.0",
|
"fb-watchman": "^2.0.0",
|
||||||
|
"fsevents": "^2.1.2",
|
||||||
"graceful-fs": "^4.2.4",
|
"graceful-fs": "^4.2.4",
|
||||||
"jest-regex-util": "^26.0.0",
|
"jest-regex-util": "^26.0.0",
|
||||||
"jest-serializer": "^26.6.2",
|
"jest-serializer": "^26.6.2",
|
||||||
@ -36020,6 +36100,7 @@
|
|||||||
"@types/node": "*",
|
"@types/node": "*",
|
||||||
"anymatch": "^3.0.3",
|
"anymatch": "^3.0.3",
|
||||||
"fb-watchman": "^2.0.0",
|
"fb-watchman": "^2.0.0",
|
||||||
|
"fsevents": "^2.1.2",
|
||||||
"graceful-fs": "^4.2.4",
|
"graceful-fs": "^4.2.4",
|
||||||
"jest-regex-util": "^26.0.0",
|
"jest-regex-util": "^26.0.0",
|
||||||
"jest-serializer": "^26.6.2",
|
"jest-serializer": "^26.6.2",
|
||||||
@ -36390,6 +36471,7 @@
|
|||||||
"@types/node": "*",
|
"@types/node": "*",
|
||||||
"anymatch": "^3.0.3",
|
"anymatch": "^3.0.3",
|
||||||
"fb-watchman": "^2.0.0",
|
"fb-watchman": "^2.0.0",
|
||||||
|
"fsevents": "^2.1.2",
|
||||||
"graceful-fs": "^4.2.4",
|
"graceful-fs": "^4.2.4",
|
||||||
"jest-regex-util": "^26.0.0",
|
"jest-regex-util": "^26.0.0",
|
||||||
"jest-serializer": "^26.6.2",
|
"jest-serializer": "^26.6.2",
|
||||||
@ -37550,7 +37632,8 @@
|
|||||||
"esprima": "^4.0.1",
|
"esprima": "^4.0.1",
|
||||||
"estraverse": "^4.2.0",
|
"estraverse": "^4.2.0",
|
||||||
"esutils": "^2.0.2",
|
"esutils": "^2.0.2",
|
||||||
"optionator": "^0.8.1"
|
"optionator": "^0.8.1",
|
||||||
|
"source-map": "~0.6.1"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"escodegen": "bin/escodegen.js",
|
"escodegen": "bin/escodegen.js",
|
||||||
@ -38071,8 +38154,11 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"errno": "^0.1.1",
|
"errno": "^0.1.1",
|
||||||
"graceful-fs": "^4.1.2",
|
"graceful-fs": "^4.1.2",
|
||||||
|
"image-size": "~0.5.0",
|
||||||
"make-dir": "^2.1.0",
|
"make-dir": "^2.1.0",
|
||||||
"mime": "^1.4.1",
|
"mime": "^1.4.1",
|
||||||
|
"native-request": "^1.0.5",
|
||||||
|
"source-map": "~0.6.0",
|
||||||
"tslib": "^1.10.0"
|
"tslib": "^1.10.0"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
@ -43781,6 +43867,9 @@
|
|||||||
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.23.0.tgz",
|
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.23.0.tgz",
|
||||||
"integrity": "sha512-c29LVsqOaLbBHuIbsTxaKENh1N2EQBOHaWv7gkHN4dgRbxSREqDnDbtFJYdpPauS4YCplMSNCABQ6Eeor69bAA==",
|
"integrity": "sha512-c29LVsqOaLbBHuIbsTxaKENh1N2EQBOHaWv7gkHN4dgRbxSREqDnDbtFJYdpPauS4YCplMSNCABQ6Eeor69bAA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"clipboard": "^2.0.0"
|
||||||
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"clipboard": "^2.0.0"
|
"clipboard": "^2.0.0"
|
||||||
}
|
}
|
||||||
@ -45399,6 +45488,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"anymatch": "~3.1.1",
|
"anymatch": "~3.1.1",
|
||||||
"braces": "~3.0.2",
|
"braces": "~3.0.2",
|
||||||
|
"fsevents": "~2.3.1",
|
||||||
"glob-parent": "~5.1.0",
|
"glob-parent": "~5.1.0",
|
||||||
"is-binary-path": "~2.1.0",
|
"is-binary-path": "~2.1.0",
|
||||||
"is-glob": "~4.0.1",
|
"is-glob": "~4.0.1",
|
||||||
@ -46741,6 +46831,9 @@
|
|||||||
"version": "1.22.0",
|
"version": "1.22.0",
|
||||||
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.22.0.tgz",
|
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.22.0.tgz",
|
||||||
"integrity": "sha512-lLJ/Wt9yy0AiSYBf212kK3mM5L8ycwlyTlSxHBAneXLR0nzFMlZ5y7riFPF3E33zXOF2IH95xdY5jIyZbM9z/w==",
|
"integrity": "sha512-lLJ/Wt9yy0AiSYBf212kK3mM5L8ycwlyTlSxHBAneXLR0nzFMlZ5y7riFPF3E33zXOF2IH95xdY5jIyZbM9z/w==",
|
||||||
|
"dependencies": {
|
||||||
|
"clipboard": "^2.0.0"
|
||||||
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"clipboard": "^2.0.0"
|
"clipboard": "^2.0.0"
|
||||||
}
|
}
|
||||||
@ -49678,7 +49771,8 @@
|
|||||||
"esprima": "^4.0.1",
|
"esprima": "^4.0.1",
|
||||||
"estraverse": "^4.2.0",
|
"estraverse": "^4.2.0",
|
||||||
"esutils": "^2.0.2",
|
"esutils": "^2.0.2",
|
||||||
"optionator": "^0.8.1"
|
"optionator": "^0.8.1",
|
||||||
|
"source-map": "~0.6.1"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"escodegen": "bin/escodegen.js",
|
"escodegen": "bin/escodegen.js",
|
||||||
@ -53103,8 +53197,10 @@
|
|||||||
"integrity": "sha512-aWAgTW4MoSJzZPAicljkO1hsi1oKj/RRq/OJQh2PKI2UKL04c2Bs+MBOB+BBABHTXJpf9mCwHN7ANCvYsvY2sg==",
|
"integrity": "sha512-aWAgTW4MoSJzZPAicljkO1hsi1oKj/RRq/OJQh2PKI2UKL04c2Bs+MBOB+BBABHTXJpf9mCwHN7ANCvYsvY2sg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"chokidar": "^3.4.1",
|
||||||
"graceful-fs": "^4.1.2",
|
"graceful-fs": "^4.1.2",
|
||||||
"neo-async": "^2.5.0"
|
"neo-async": "^2.5.0",
|
||||||
|
"watchpack-chokidar2": "^2.0.0"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"chokidar": "^3.4.1",
|
"chokidar": "^3.4.1",
|
||||||
@ -54017,6 +54113,7 @@
|
|||||||
"anymatch": "^2.0.0",
|
"anymatch": "^2.0.0",
|
||||||
"async-each": "^1.0.1",
|
"async-each": "^1.0.1",
|
||||||
"braces": "^2.3.2",
|
"braces": "^2.3.2",
|
||||||
|
"fsevents": "^1.2.7",
|
||||||
"glob-parent": "^3.1.0",
|
"glob-parent": "^3.1.0",
|
||||||
"inherits": "^2.0.3",
|
"inherits": "^2.0.3",
|
||||||
"is-binary-path": "^1.0.0",
|
"is-binary-path": "^1.0.0",
|
||||||
@ -70509,6 +70606,31 @@
|
|||||||
"@testing-library/dom": "^7.27.1"
|
"@testing-library/dom": "^7.27.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@testing-library/react-hooks": {
|
||||||
|
"version": "5.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@testing-library/react-hooks/-/react-hooks-5.0.3.tgz",
|
||||||
|
"integrity": "sha512-UrnnRc5II7LMH14xsYNm/WRch/67cBafmrSQcyFh0v+UUmSf1uzfB7zn5jQXSettGwOSxJwdQUN7PgkT0w22Lg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@babel/runtime": "^7.12.5",
|
||||||
|
"@types/react": ">=16.9.0",
|
||||||
|
"@types/react-dom": ">=16.9.0",
|
||||||
|
"@types/react-test-renderer": ">=16.9.0",
|
||||||
|
"filter-console": "^0.1.1",
|
||||||
|
"react-error-boundary": "^3.1.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"react-error-boundary": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-error-boundary/-/react-error-boundary-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-lmPrdi5SLRJR+AeJkqdkGlW/CRkAUvZnETahK58J4xb5wpbfDngasEGu+w0T1iXEhVrYBJZeW+c4V1hILCnMWQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@babel/runtime": "^7.12.5"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"@testing-library/user-event": {
|
"@testing-library/user-event": {
|
||||||
"version": "12.7.0",
|
"version": "12.7.0",
|
||||||
"resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-12.7.0.tgz",
|
"resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-12.7.0.tgz",
|
||||||
@ -71152,6 +71274,15 @@
|
|||||||
"@types/react": "*"
|
"@types/react": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@types/react-test-renderer": {
|
||||||
|
"version": "17.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/react-test-renderer/-/react-test-renderer-17.0.1.tgz",
|
||||||
|
"integrity": "sha512-3Fi2O6Zzq/f3QR9dRnlnHso9bMl7weKCviFmfF6B4LS1Uat6Hkm15k0ZAQuDz+UBq6B3+g+NM6IT2nr5QgPzCw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@types/react": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@types/react-transition-group": {
|
"@types/react-transition-group": {
|
||||||
"version": "4.4.0",
|
"version": "4.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.0.tgz",
|
||||||
@ -81364,6 +81495,12 @@
|
|||||||
"to-regex-range": "^2.1.0"
|
"to-regex-range": "^2.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"filter-console": {
|
||||||
|
"version": "0.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/filter-console/-/filter-console-0.1.1.tgz",
|
||||||
|
"integrity": "sha512-zrXoV1Uaz52DqPs+qEwNJWJFAWZpYJ47UNmpN9q4j+/EYsz85uV0DC9k8tRND5kYmoVzL0W+Y75q4Rg8sRJCdg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"finalhandler": {
|
"finalhandler": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz",
|
||||||
|
@ -201,6 +201,7 @@
|
|||||||
"@testing-library/dom": "^7.29.4",
|
"@testing-library/dom": "^7.29.4",
|
||||||
"@testing-library/jest-dom": "^5.11.6",
|
"@testing-library/jest-dom": "^5.11.6",
|
||||||
"@testing-library/react": "^11.2.0",
|
"@testing-library/react": "^11.2.0",
|
||||||
|
"@testing-library/react-hooks": "^5.0.3",
|
||||||
"@testing-library/user-event": "^12.7.0",
|
"@testing-library/user-event": "^12.7.0",
|
||||||
"@types/classnames": "^2.2.10",
|
"@types/classnames": "^2.2.10",
|
||||||
"@types/dom-to-image": "^2.6.0",
|
"@types/dom-to-image": "^2.6.0",
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export * from './useComponentDidMount';
|
@ -0,0 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
import { renderHook } from '@testing-library/react-hooks';
|
||||||
|
import { useComponentDidMount } from './useComponentDidMount';
|
||||||
|
|
||||||
|
test('the effect should only be executed on the first render', () => {
|
||||||
|
const effect = jest.fn();
|
||||||
|
const hook = renderHook(() => useComponentDidMount(effect));
|
||||||
|
expect(effect).toBeCalledTimes(1);
|
||||||
|
hook.rerender();
|
||||||
|
expect(effect).toBeCalledTimes(1);
|
||||||
|
});
|
@ -0,0 +1,24 @@
|
|||||||
|
/**
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
import { EffectCallback, useEffect } from 'react';
|
||||||
|
|
||||||
|
export const useComponentDidMount = (effect: EffectCallback) => {
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
useEffect(effect, []);
|
||||||
|
};
|
@ -0,0 +1,66 @@
|
|||||||
|
/**
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
import '@testing-library/jest-dom';
|
||||||
|
import { render, screen } from '@testing-library/react';
|
||||||
|
import React from 'react';
|
||||||
|
import { Provider } from 'react-redux';
|
||||||
|
import { store } from 'src/views/store';
|
||||||
|
import FlashProvider, { FlashMessage } from './index';
|
||||||
|
|
||||||
|
test('Rerendering correctly with default props', () => {
|
||||||
|
const messages: FlashMessage[] = [];
|
||||||
|
render(
|
||||||
|
<Provider store={store}>
|
||||||
|
<FlashProvider messages={messages}>
|
||||||
|
<div data-test-id="my-component">My Component</div>
|
||||||
|
</FlashProvider>
|
||||||
|
</Provider>,
|
||||||
|
);
|
||||||
|
expect(screen.getByTestId('my-component')).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('messages should only be inserted in the State when the component is mounted', () => {
|
||||||
|
const messages: FlashMessage[] = [
|
||||||
|
['info', 'teste message 01'],
|
||||||
|
['info', 'teste message 02'],
|
||||||
|
];
|
||||||
|
expect(store.getState().messageToasts).toEqual([]);
|
||||||
|
const { rerender } = render(
|
||||||
|
<Provider store={store}>
|
||||||
|
<FlashProvider messages={messages}>
|
||||||
|
<div data-teste-id="my-component">My Component</div>
|
||||||
|
</FlashProvider>
|
||||||
|
</Provider>,
|
||||||
|
);
|
||||||
|
const fistRender = store.getState().messageToasts;
|
||||||
|
expect(fistRender).toHaveLength(2);
|
||||||
|
expect(fistRender[1].text).toBe(messages[0][1]);
|
||||||
|
expect(fistRender[0].text).toBe(messages[1][1]);
|
||||||
|
|
||||||
|
rerender(
|
||||||
|
<Provider store={store}>
|
||||||
|
<FlashProvider messages={[...messages, ['info', 'teste message 03']]}>
|
||||||
|
<div data-teste-id="my-component">My Component</div>
|
||||||
|
</FlashProvider>
|
||||||
|
</Provider>,
|
||||||
|
);
|
||||||
|
|
||||||
|
const secondRender = store.getState().messageToasts;
|
||||||
|
expect(secondRender).toEqual(fistRender);
|
||||||
|
});
|
@ -16,17 +16,15 @@
|
|||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
import React from 'react';
|
import { useToasts } from 'src/messageToasts/enhancers/withToasts';
|
||||||
import withToasts from 'src/messageToasts/enhancers/withToasts';
|
import { useComponentDidMount } from 'src/common/hooks/useComponentDidMount';
|
||||||
|
|
||||||
type Message = Array<string>;
|
type FlashMessageType = 'info' | 'alert' | 'danger' | 'warning' | 'success';
|
||||||
|
export type FlashMessage = [FlashMessageType, string];
|
||||||
|
|
||||||
interface CommonObject {
|
|
||||||
flash_messages: Array<Message>;
|
|
||||||
}
|
|
||||||
interface Props {
|
interface Props {
|
||||||
children: Node;
|
children: JSX.Element;
|
||||||
common: CommonObject;
|
messages: FlashMessage[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const flashObj = {
|
const flashObj = {
|
||||||
@ -37,21 +35,17 @@ const flashObj = {
|
|||||||
success: 'addSuccessToast',
|
success: 'addSuccessToast',
|
||||||
};
|
};
|
||||||
|
|
||||||
class FlashProvider extends React.PureComponent<Props> {
|
export default function FlashProvider({ children, messages }: Props) {
|
||||||
componentDidMount() {
|
const toasts = useToasts();
|
||||||
const flashMessages = this.props.common.flash_messages;
|
useComponentDidMount(() => {
|
||||||
flashMessages.forEach(message => {
|
messages.forEach(message => {
|
||||||
const [type, text] = message;
|
const [type, text] = message;
|
||||||
const flash = flashObj[type];
|
const flash = flashObj[type];
|
||||||
if (this.props[flash]) {
|
const toast = toasts[flash];
|
||||||
this.props[flash](text);
|
if (toast) {
|
||||||
|
toast(text);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
return children;
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
|
||||||
return this.props.children;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default withToasts(FlashProvider);
|
|
@ -35,6 +35,7 @@ import {
|
|||||||
setInLocalStorage,
|
setInLocalStorage,
|
||||||
} from 'src/utils/localStorageHelpers';
|
} from 'src/utils/localStorageHelpers';
|
||||||
import { URL_PARAMS } from 'src/constants';
|
import { URL_PARAMS } from 'src/constants';
|
||||||
|
import cx from 'classnames';
|
||||||
import ExploreChartPanel from './ExploreChartPanel';
|
import ExploreChartPanel from './ExploreChartPanel';
|
||||||
import ConnectedControlPanelsContainer from './ControlPanelsContainer';
|
import ConnectedControlPanelsContainer from './ControlPanelsContainer';
|
||||||
import SaveModal from './SaveModal';
|
import SaveModal from './SaveModal';
|
||||||
@ -528,9 +529,10 @@ function ExploreViewContainer(props) {
|
|||||||
/>
|
/>
|
||||||
</Resizable>
|
</Resizable>
|
||||||
<div
|
<div
|
||||||
className={`main-explore-content ${
|
className={cx(
|
||||||
isCollapsed ? 'col-sm-9' : 'col-sm-7'
|
'main-explore-content',
|
||||||
}`}
|
isCollapsed ? 'col-sm-9' : 'col-sm-7',
|
||||||
|
)}
|
||||||
>
|
>
|
||||||
{renderChartContainer()}
|
{renderChartContainer()}
|
||||||
</div>
|
</div>
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
import React, { Suspense } from 'react';
|
import React, { Suspense } from 'react';
|
||||||
import { hot } from 'react-hot-loader/root';
|
import { hot } from 'react-hot-loader/root';
|
||||||
import thunk from 'redux-thunk';
|
|
||||||
import { createStore, applyMiddleware, compose, combineReducers } from 'redux';
|
|
||||||
import { Provider as ReduxProvider } from 'react-redux';
|
import { Provider as ReduxProvider } from 'react-redux';
|
||||||
import { BrowserRouter as Router, Switch, Route } from 'react-router-dom';
|
import { BrowserRouter as Router, Switch, Route } from 'react-router-dom';
|
||||||
import { QueryParamProvider } from 'use-query-params';
|
import { QueryParamProvider } from 'use-query-params';
|
||||||
@ -34,9 +32,8 @@ import { theme } from 'src/preamble';
|
|||||||
import ToastPresenter from 'src/messageToasts/containers/ToastPresenter';
|
import ToastPresenter from 'src/messageToasts/containers/ToastPresenter';
|
||||||
import setupPlugins from 'src/setup/setupPlugins';
|
import setupPlugins from 'src/setup/setupPlugins';
|
||||||
import setupApp from 'src/setup/setupApp';
|
import setupApp from 'src/setup/setupApp';
|
||||||
import messageToastReducer from 'src/messageToasts/reducers';
|
|
||||||
import { initEnhancer } from 'src/reduxUtils';
|
|
||||||
import { routes, isFrontendRoute } from 'src/views/routes';
|
import { routes, isFrontendRoute } from 'src/views/routes';
|
||||||
|
import { store } from './store';
|
||||||
|
|
||||||
setupApp();
|
setupApp();
|
||||||
setupPlugins();
|
setupPlugins();
|
||||||
@ -48,19 +45,10 @@ const menu = { ...bootstrap.common.menu_data };
|
|||||||
const common = { ...bootstrap.common };
|
const common = { ...bootstrap.common };
|
||||||
initFeatureFlags(bootstrap.common.feature_flags);
|
initFeatureFlags(bootstrap.common.feature_flags);
|
||||||
|
|
||||||
const store = createStore(
|
|
||||||
combineReducers({
|
|
||||||
messageToasts: messageToastReducer,
|
|
||||||
common: () => common,
|
|
||||||
}),
|
|
||||||
{},
|
|
||||||
compose(applyMiddleware(thunk), initEnhancer(false)),
|
|
||||||
);
|
|
||||||
|
|
||||||
const App = () => (
|
const App = () => (
|
||||||
<ReduxProvider store={store}>
|
<ReduxProvider store={store}>
|
||||||
<ThemeProvider theme={theme}>
|
<ThemeProvider theme={theme}>
|
||||||
<FlashProvider common={common}>
|
<FlashProvider messages={common.flash_messages}>
|
||||||
<Router>
|
<Router>
|
||||||
<DynamicPluginProvider>
|
<DynamicPluginProvider>
|
||||||
<QueryParamProvider
|
<QueryParamProvider
|
||||||
|
35
superset-frontend/src/views/store.ts
Normal file
35
superset-frontend/src/views/store.ts
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/**
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
import { applyMiddleware, combineReducers, compose, createStore } from 'redux';
|
||||||
|
import thunk from 'redux-thunk';
|
||||||
|
import messageToastReducer from 'src/messageToasts/reducers';
|
||||||
|
import { initEnhancer } from 'src/reduxUtils';
|
||||||
|
|
||||||
|
const container = document.getElementById('app');
|
||||||
|
const bootstrap = JSON.parse(container?.getAttribute('data-bootstrap') ?? '{}');
|
||||||
|
const common = { ...bootstrap.common };
|
||||||
|
|
||||||
|
export const store = createStore(
|
||||||
|
combineReducers({
|
||||||
|
messageToasts: messageToastReducer,
|
||||||
|
common: () => common,
|
||||||
|
}),
|
||||||
|
{},
|
||||||
|
compose(applyMiddleware(thunk), initEnhancer(false)),
|
||||||
|
);
|
Loading…
Reference in New Issue
Block a user