@verdaccio/ui-theme 6.0.0-6-next.9 → 6.0.0-6-next.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +1 -1
- package/.eslintrc +0 -15
- package/CHANGELOG.md +61 -0
- package/jest/api/packages.json +42 -0
- package/jest/jest.config.js +2 -2
- package/jest/server-handlers.ts +9 -0
- package/jest/server.ts +6 -0
- package/jest/setup-env.ts +18 -0
- package/jest/setup.ts +2 -7
- package/jest/unit/components/__mocks__/token.ts +0 -1
- package/jest/unit/components/store/login.ts +1 -0
- package/package.json +43 -33
- package/src/App/App.test.tsx +75 -51
- package/src/App/App.tsx +7 -42
- package/src/App/AppRoute.tsx +3 -16
- package/src/App/Footer/Footer.test.tsx +0 -1
- package/src/App/Footer/Footer.tsx +35 -22
- package/src/App/Footer/__snapshots__/Footer.test.tsx.snap +208 -302
- package/src/App/Footer/styles.ts +2 -3
- package/src/App/Header/Header.test.tsx +53 -61
- package/src/App/Header/Header.tsx +13 -24
- package/src/App/Header/HeaderGreetings.tsx +0 -1
- package/src/App/Header/HeaderLeft.tsx +0 -1
- package/src/App/Header/HeaderMenu.tsx +6 -6
- package/src/App/Header/HeaderRight.tsx +1 -2
- package/src/App/Header/HeaderToolTip.tsx +0 -1
- package/src/App/Header/HeaderToolTipIcon.tsx +10 -10
- package/src/App/Header/LanguageSwitch.tsx +17 -79
- package/src/App/Header/LoginDialog/LoginDialog.test.tsx +25 -35
- package/src/App/Header/LoginDialog/LoginDialog.tsx +28 -46
- package/src/App/Header/LoginDialog/LoginDialogCloseButton.tsx +1 -2
- package/src/App/Header/LoginDialog/LoginDialogForm.tsx +0 -1
- package/src/App/Header/LoginDialog/LoginDialogFormError.tsx +1 -2
- package/src/App/Header/LoginDialog/LoginDialogHeader.tsx +4 -4
- package/src/App/Header/RegistryInfoContent/RegistryInfoContent.test.tsx +1 -3
- package/src/App/Header/RegistryInfoContent/RegistryInfoContent.tsx +9 -10
- package/src/App/Header/RegistryInfoDialog/RegistryInfoDialog.tsx +1 -2
- package/src/App/Header/RegistryInfoDialog/styles.ts +0 -1
- package/src/App/Header/Search/Search.test.tsx +48 -43
- package/src/App/Header/Search/Search.tsx +23 -108
- package/src/App/Header/Search/__snapshots__/Search.test.tsx.snap +392 -28
- package/src/App/Header/styles.ts +2 -3
- package/src/App/index.ts +0 -1
- package/src/App/utils/loadable.tsx +3 -1
- package/src/components/ActionBar/ActionBar.test.tsx +13 -14
- package/src/components/ActionBar/ActionBar.tsx +0 -2
- package/src/components/ActionBar/ActionBarAction.tsx +11 -14
- package/src/components/ActionBar/__snapshots__/ActionBar.test.tsx.snap +198 -53
- package/src/components/AppBar.tsx +1 -1
- package/src/components/Author/Author.test.tsx +1 -4
- package/src/components/Author/Author.tsx +2 -4
- package/src/components/Author/__snapshots__/Author.test.tsx.snap +804 -48
- package/src/components/Author/styles.ts +0 -1
- package/src/components/AutoComplete/AutoComplete.tsx +85 -163
- package/src/components/AutoComplete/AutoCompleteV2.tsx +8 -10
- package/src/components/AutoComplete/styles.tsx +0 -15
- package/src/components/Avatar.tsx +1 -1
- package/src/components/Box.tsx +1 -1
- package/src/components/Button.tsx +1 -1
- package/src/components/Card.tsx +1 -1
- package/src/components/CardActions.tsx +1 -1
- package/src/components/CardContent.tsx +1 -1
- package/src/components/Chip.tsx +1 -1
- package/src/components/CircularProgress.tsx +2 -2
- package/src/components/CopyToClipBoard.tsx +2 -3
- package/src/components/Dialog.tsx +1 -1
- package/src/components/DialogActions.tsx +2 -2
- package/src/components/DialogContent.tsx +2 -2
- package/src/components/DialogTitle.tsx +1 -1
- package/src/components/Divider.tsx +1 -1
- package/src/components/FloatingActionButton.tsx +1 -1
- package/src/components/FormControl.tsx +1 -1
- package/src/components/FormHelperText.tsx +2 -2
- package/src/components/Grid.tsx +1 -1
- package/src/components/Heading.tsx +1 -1
- package/src/components/IconButton.tsx +1 -1
- package/src/components/Icons/index.ts +1 -17
- package/src/components/Input.tsx +1 -1
- package/src/components/InputAdornment/InputAdornment.tsx +2 -2
- package/src/components/InputLabel.tsx +1 -1
- package/src/components/Label/Label.test.tsx +0 -1
- package/src/components/Label/Label.tsx +2 -3
- package/src/components/List.tsx +1 -1
- package/src/components/ListItem.tsx +1 -1
- package/src/components/ListItemText.tsx +1 -4
- package/src/components/Loading/Loading.test.tsx +0 -1
- package/src/components/Loading/Loading.tsx +1 -2
- package/src/components/Loading/Spinner/Spinner.test.tsx +1 -2
- package/src/components/Loading/Spinner/Spinner.tsx +1 -2
- package/src/components/Loading/Spinner/__snapshots__/Spinner.test.tsx.snap +114 -16
- package/src/components/Loading/__snapshots__/Loading.test.tsx.snap +63 -11
- package/src/components/Loading/styles.ts +1 -2
- package/src/components/Logo/Logo.test.tsx +0 -1
- package/src/components/Logo/Logo.tsx +1 -2
- package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +2 -0
- package/src/components/Menu.tsx +1 -1
- package/src/components/MenuItem.tsx +1 -1
- package/src/components/NotFound/NotFound.tsx +1 -3
- package/src/components/NotFound/Notfound.test.tsx +1 -2
- package/src/components/NotFound/__snapshots__/Notfound.test.tsx.snap +138 -11
- package/src/components/NotFound/styles.ts +0 -1
- package/src/components/Paper.tsx +1 -1
- package/src/components/SnackbarContent.tsx +1 -1
- package/src/components/SvgIcon.tsx +1 -1
- package/src/components/Tab.tsx +1 -1
- package/src/components/Tabs.tsx +1 -1
- package/src/components/Text/Text.tsx +1 -1
- package/src/components/Text/TextConfig.ts +1 -1
- package/src/components/TextField/TextField.test.tsx +0 -1
- package/src/components/TextField/TextField.tsx +2 -2
- package/src/components/TextField/__snapshots__/TextField.test.tsx.snap +216 -3
- package/src/components/Toolbar.tsx +1 -1
- package/src/components/Tooltip.tsx +1 -1
- package/src/design-tokens/ResetStyles.tsx +1 -1
- package/src/design-tokens/StyleBaseline.tsx +2 -2
- package/src/design-tokens/ThemeContext.ts +1 -1
- package/src/design-tokens/ThemeProvider.tsx +15 -12
- package/src/design-tokens/theme.ts +28 -26
- package/src/design-tokens/useTheme.ts +1 -1
- package/src/{design-tokens → hooks}/useLocalStorage.ts +0 -0
- package/src/{design-tokens → hooks}/useOnClickOutside.ts +0 -0
- package/src/i18n/ABOUT_TRANSLATIONS.md +13 -0
- package/src/i18n/__mocks__/loadTranslationFile.ts +5 -0
- package/src/i18n/config.ts +38 -0
- package/src/i18n/crowdin/ui.json +170 -0
- package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/cs-CZ.json +0 -0
- package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/de-DE.json +0 -0
- package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/en-US.json +0 -0
- package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/es-ES.json +0 -0
- package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/fr-FR.json +0 -0
- package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/ja-JP.json +0 -0
- package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/km-KH.json +0 -0
- package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/pt-BR.json +0 -0
- package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/ru-RU.json +0 -0
- package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/tr-TR.json +0 -0
- package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/uk-UA.json +0 -0
- package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/zh-CN.json +0 -0
- package/{i18n/translations → src/i18n/deprecated_translations_dont_use}/zh-TW.json +0 -0
- package/src/i18n/download_translations/ar-SA/ui.json +170 -0
- package/src/i18n/download_translations/cs-CZ/ui.json +170 -0
- package/src/i18n/download_translations/de-DE/ui.json +170 -0
- package/src/i18n/download_translations/es-ES/ui.json +170 -0
- package/src/i18n/download_translations/fi-FI/ui.json +170 -0
- package/src/i18n/download_translations/fil-PH/ui.json +170 -0
- package/src/i18n/download_translations/fr-FR/ui.json +170 -0
- package/src/i18n/download_translations/gl-ES/ui.json +170 -0
- package/src/i18n/download_translations/hi-IN/ui.json +170 -0
- package/src/i18n/download_translations/it-IT/ui.json +170 -0
- package/src/i18n/download_translations/ja-JP/ui.json +170 -0
- package/src/i18n/download_translations/km-KH/ui.json +170 -0
- package/src/i18n/download_translations/ko-KR/ui.json +170 -0
- package/src/i18n/download_translations/pl-PL/ui.json +170 -0
- package/src/i18n/download_translations/pt-BR/ui.json +170 -0
- package/src/i18n/download_translations/pt-PT/ui.json +170 -0
- package/src/i18n/download_translations/ro-RO/ui.json +170 -0
- package/src/i18n/download_translations/ru-RU/ui.json +170 -0
- package/src/i18n/download_translations/si-LK/ui.json +170 -0
- package/src/i18n/download_translations/sr-CS/ui.json +170 -0
- package/src/i18n/download_translations/sr-SP/ui.json +170 -0
- package/src/i18n/download_translations/tg-TJ/ui.json +170 -0
- package/src/i18n/download_translations/tr-TR/ui.json +170 -0
- package/src/i18n/download_translations/uk-UA/ui.json +170 -0
- package/src/i18n/download_translations/vi-VN/ui.json +170 -0
- package/src/i18n/download_translations/yo-NG/ui.json +170 -0
- package/src/i18n/download_translations/zh-CN/ui.json +170 -0
- package/src/i18n/download_translations/zh-TW/ui.json +170 -0
- package/src/i18n/enabledLanguages.ts +35 -0
- package/src/i18n/loadTranslationFile.ts +14 -0
- package/src/index.tsx +13 -11
- package/src/pages/Version/DetailContainer/Dependencies/Dependencies.test.tsx +0 -2
- package/src/pages/Version/DetailContainer/Dependencies/Dependencies.tsx +1 -3
- package/src/pages/Version/DetailContainer/Dependencies/styles.ts +0 -1
- package/src/pages/Version/DetailContainer/Deprecated/Deprecated.test.tsx +1 -3
- package/src/pages/Version/DetailContainer/Deprecated/Deprecated.tsx +2 -3
- package/src/pages/Version/DetailContainer/DetailContainer.test.tsx +0 -1
- package/src/pages/Version/DetailContainer/DetailContainer.tsx +1 -3
- package/src/pages/Version/DetailContainer/DetailContainerContent.tsx +0 -1
- package/src/pages/Version/DetailContainer/DetailContainerContentReadme.tsx +0 -1
- package/src/pages/Version/DetailContainer/DetailContainerTabs.tsx +0 -1
- package/src/pages/Version/DetailContainer/NoItems/NoItems.tsx +0 -1
- package/src/pages/Version/DetailContainer/NoItems/Noitems.test.tsx +0 -1
- package/src/pages/Version/DetailContainer/NoItems/__snapshots__/Noitems.test.tsx.snap +10 -1
- package/src/pages/Version/DetailContainer/Readme/Readme.spec.tsx +1 -2
- package/src/pages/Version/DetailContainer/Readme/Readme.tsx +1 -2
- package/src/pages/Version/DetailContainer/UpLinks/UpLinks.test.tsx +1 -9
- package/src/pages/Version/DetailContainer/UpLinks/UpLinks.tsx +1 -3
- package/src/pages/Version/DetailContainer/UpLinks/__snapshots__/UpLinks.test.tsx.snap +184 -26
- package/src/pages/Version/DetailContainer/UpLinks/styles.ts +2 -3
- package/src/pages/Version/DetailContainer/Versions/Versions.test.tsx +3 -5
- package/src/pages/Version/DetailContainer/Versions/Versions.tsx +1 -2
- package/src/pages/Version/DetailContainer/Versions/VersionsHistoryList.tsx +2 -4
- package/src/pages/Version/DetailContainer/Versions/VersionsTagList.tsx +1 -3
- package/src/pages/Version/DetailContainer/Versions/styles.ts +2 -3
- package/src/pages/Version/DetailContainer/__snapshots__/DetailContainer.test.tsx.snap +168 -34
- package/src/pages/Version/DetailSidebar/DetailSidebar.tsx +0 -2
- package/src/pages/Version/DetailSidebar/DetailSidebarFundButton.test.tsx +0 -2
- package/src/pages/Version/DetailSidebar/DetailSidebarFundButton.tsx +1 -2
- package/src/pages/Version/DetailSidebar/DetailSidebarTitle.tsx +0 -1
- package/src/pages/Version/DetailSidebar/Developers/Developers.test.tsx +3 -5
- package/src/pages/Version/DetailSidebar/Developers/Developers.tsx +3 -5
- package/src/pages/Version/DetailSidebar/Developers/DevelopersTitle.tsx +0 -1
- package/src/pages/Version/DetailSidebar/Developers/__snapshots__/Developers.test.tsx.snap +328 -40
- package/src/pages/Version/DetailSidebar/Developers/styles.ts +0 -1
- package/src/pages/Version/DetailSidebar/Dist/Dist.test.tsx +1 -3
- package/src/pages/Version/DetailSidebar/Dist/Dist.tsx +1 -3
- package/src/pages/Version/DetailSidebar/Dist/__snapshots__/Dist.test.tsx.snap +1436 -74
- package/src/pages/Version/DetailSidebar/Dist/styles.ts +2 -1
- package/src/pages/Version/DetailSidebar/Engines/Engines.test.tsx +1 -3
- package/src/pages/Version/DetailSidebar/Engines/Engines.tsx +1 -3
- package/src/pages/Version/DetailSidebar/Engines/styles.ts +0 -1
- package/src/pages/Version/DetailSidebar/Install/Install.test.tsx +1 -3
- package/src/pages/Version/DetailSidebar/Install/Install.tsx +0 -2
- package/src/pages/Version/DetailSidebar/Install/InstallListItem.tsx +0 -1
- package/src/pages/Version/DetailSidebar/Repository/Repository.test.tsx +1 -3
- package/src/pages/Version/DetailSidebar/Repository/Repository.tsx +1 -3
- package/src/pages/Version/Version.test.tsx +3 -5
- package/src/pages/Version/Version.tsx +21 -6
- package/src/pages/Version/VersionContextProvider.tsx +14 -45
- package/src/pages/Version/VersionLayout.tsx +1 -1
- package/src/pages/Version/context.ts +1 -1
- package/src/pages/home/Home.tsx +9 -28
- package/src/pages/home/PackageList/Help/Help.test.tsx +0 -1
- package/src/pages/home/PackageList/Help/Help.tsx +0 -1
- package/src/pages/home/PackageList/Help/__snapshots__/Help.test.tsx.snap +298 -59
- package/src/pages/home/PackageList/Help/styles.ts +0 -1
- package/src/pages/home/PackageList/Package/Package.test.tsx +5 -4
- package/src/pages/home/PackageList/Package/Package.tsx +20 -28
- package/src/pages/home/PackageList/Package/Tag/Tag.test.tsx +0 -1
- package/src/pages/home/PackageList/Package/styles.ts +5 -6
- package/src/pages/home/PackageList/PackageList.tsx +17 -17
- package/src/pages/home/PackageList/Packagelist.test.tsx +6 -5
- package/src/providers/API/api.test.ts +1 -0
- package/src/providers/API/api.ts +7 -3
- package/src/providers/config/AppConfigurationProvider.tsx +3 -3
- package/src/store/index.ts +1 -0
- package/src/store/models/configuration.ts +41 -0
- package/src/store/models/download.ts +30 -0
- package/src/store/models/index.ts +18 -0
- package/src/store/models/login.ts +92 -0
- package/src/store/models/manifest.ts +91 -0
- package/src/store/models/packages.ts +36 -0
- package/src/store/models/search.ts +81 -0
- package/src/store/store.ts +15 -0
- package/src/utils/login.test.ts +3 -4
- package/src/utils/package.test.ts +2 -3
- package/src/utils/package.ts +2 -1
- package/src/utils/sec-utils.ts +1 -1
- package/src/utils/test-react-testing-library.tsx +22 -5
- package/src/utils/url.test.ts +1 -1
- package/src/utils/url.ts +1 -0
- package/static/Dependencies.15768a14646212b71166.js +2 -0
- package/static/Dependencies.15768a14646212b71166.js.LICENSE.txt +78 -0
- package/static/Dist.15768a14646212b71166.js +2 -0
- package/static/Dist.15768a14646212b71166.js.LICENSE.txt +60 -0
- package/static/Engines.15768a14646212b71166.js +2 -0
- package/static/Engines.15768a14646212b71166.js.LICENSE.txt +66 -0
- package/static/Home.15768a14646212b71166.js +2 -0
- package/static/Home.15768a14646212b71166.js.LICENSE.txt +222 -0
- package/static/Install.15768a14646212b71166.js +2 -0
- package/static/Install.15768a14646212b71166.js.LICENSE.txt +66 -0
- package/static/NotFound.15768a14646212b71166.js +2 -0
- package/static/NotFound.15768a14646212b71166.js.LICENSE.txt +40 -0
- package/static/Provider.15768a14646212b71166.js +2 -0
- package/static/Provider.15768a14646212b71166.js.LICENSE.txt +32 -0
- package/static/Repository.15768a14646212b71166.js +2 -0
- package/static/Repository.15768a14646212b71166.js.LICENSE.txt +50 -0
- package/static/UpLinks.15768a14646212b71166.js +2 -0
- package/static/UpLinks.15768a14646212b71166.js.LICENSE.txt +56 -0
- package/static/Version.15768a14646212b71166.js +2 -0
- package/static/Version.15768a14646212b71166.js.LICENSE.txt +380 -0
- package/static/Versions.15768a14646212b71166.js +2 -0
- package/static/Versions.15768a14646212b71166.js.LICENSE.txt +64 -0
- package/static/index.html +1 -1
- package/static/main.15768a14646212b71166.js +2 -0
- package/static/main.15768a14646212b71166.js.LICENSE.txt +972 -0
- package/static/manifest.json +17 -3
- package/static/runtime.15768a14646212b71166.js +2 -0
- package/static/{runtime.9525ddaaf85378590c63.js.LICENSE.txt → runtime.15768a14646212b71166.js.LICENSE.txt} +2 -2
- package/static/vendors-node_modules_pnpm_mui_icons-material_5_0_5_d1eeebd4022867ee03864a00e16c7901_node_modu-123400.15768a14646212b71166.js +2 -0
- package/static/vendors-node_modules_pnpm_mui_icons-material_5_0_5_d1eeebd4022867ee03864a00e16c7901_node_modu-123400.15768a14646212b71166.js.LICENSE.txt +148 -0
- package/static/vendors-node_modules_pnpm_mui_icons-material_5_0_5_d1eeebd4022867ee03864a00e16c7901_node_modu-d2b578.15768a14646212b71166.js +2 -0
- package/static/vendors-node_modules_pnpm_mui_icons-material_5_0_5_d1eeebd4022867ee03864a00e16c7901_node_modu-d2b578.15768a14646212b71166.js.LICENSE.txt +218 -0
- package/static/vendors-node_modules_pnpm_mui_material_5_0_6_033766d34292bd5d464212fd95cb4b6d_node_modules_mu-1fb115.15768a14646212b71166.js +2 -0
- package/static/vendors-node_modules_pnpm_mui_material_5_0_6_033766d34292bd5d464212fd95cb4b6d_node_modules_mu-1fb115.15768a14646212b71166.js.LICENSE.txt +316 -0
- package/static/vendors.15768a14646212b71166.js +103 -0
- package/static/vendors.15768a14646212b71166.js.LICENSE.txt +3158 -0
- package/tools/dev.server.js +0 -1
- package/tools/webpack.dev.config.babel.js +1 -3
- package/tools/webpack.prod.config.babel.js +1 -1
- package/tsconfig.json +1 -3
- package/types/index.ts +3 -20
- package/i18n/config.ts +0 -94
- package/src/App/AppContext.ts +0 -18
- package/src/App/AppContextProvider.tsx +0 -44
- package/src/App/Header/Search/SearchAdornment.tsx +0 -18
- package/src/components/Icons/Austria.tsx +0 -23
- package/src/components/Icons/Brazil.tsx +0 -44
- package/src/components/Icons/China.tsx +0 -33
- package/src/components/Icons/Czech.tsx +0 -21
- package/src/components/Icons/France.tsx +0 -27
- package/src/components/Icons/Germany.tsx +0 -27
- package/src/components/Icons/India.tsx +0 -44
- package/src/components/Icons/Japan.tsx +0 -23
- package/src/components/Icons/Khmer.tsx +0 -40
- package/src/components/Icons/Nicaragua.tsx +0 -66
- package/src/components/Icons/Russia.tsx +0 -27
- package/src/components/Icons/Spain.tsx +0 -43
- package/src/components/Icons/Taiwan.tsx +0 -25
- package/src/components/Icons/Turkey.tsx +0 -23
- package/src/components/Icons/Ukraine.tsx +0 -30
- package/src/components/Icons/Usa.tsx +0 -34
- package/src/design-tokens/emotion.ts +0 -5
- package/src/lib/constants.ts +0 -9
- package/src/pages/Version/DetailSidebar/ActionBar/ActionBar.test.tsx +0 -84
- package/src/pages/Version/DetailSidebar/ActionBar/__snapshots__/ActionBar.test.tsx.snap +0 -122
- package/src/pages/Version/is-package-version-valid.ts +0 -19
- package/src/providers/API/APIProvider.tsx +0 -109
- package/src/providers/API/index.ts +0 -1
- package/static/main.9525ddaaf85378590c63.js +0 -2
- package/static/main.9525ddaaf85378590c63.js.LICENSE.txt +0 -1588
- package/static/runtime.9525ddaaf85378590c63.js +0 -2
- package/static/vendors.9525ddaaf85378590c63.js +0 -2
- package/static/vendors.9525ddaaf85378590c63.js.LICENSE.txt +0 -4540
|
@@ -1,80 +1,77 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BrowserRouter as Router } from 'react-router-dom';
|
|
3
|
-
|
|
4
3
|
import {
|
|
5
|
-
|
|
4
|
+
cleanup,
|
|
6
5
|
fireEvent,
|
|
7
|
-
|
|
6
|
+
renderWithStore,
|
|
8
7
|
screen,
|
|
8
|
+
waitFor,
|
|
9
9
|
waitForElementToBeRemoved,
|
|
10
10
|
} from 'verdaccio-ui/utils/test-react-testing-library';
|
|
11
11
|
|
|
12
|
-
import translationEN from '
|
|
13
|
-
import {
|
|
14
|
-
|
|
12
|
+
import translationEN from '../../i18n/crowdin/ui.json';
|
|
13
|
+
import { store } from '../../store';
|
|
15
14
|
import Header from './Header';
|
|
16
15
|
|
|
17
|
-
const props = {
|
|
18
|
-
user: {
|
|
19
|
-
username: 'verddacio-user',
|
|
20
|
-
},
|
|
21
|
-
packages: [],
|
|
22
|
-
};
|
|
23
|
-
|
|
24
16
|
/* eslint-disable react/jsx-no-bind*/
|
|
25
17
|
describe('<Header /> component with logged in state', () => {
|
|
18
|
+
afterEach(cleanup);
|
|
19
|
+
|
|
26
20
|
test('should load the component in logged out state', () => {
|
|
27
|
-
|
|
21
|
+
renderWithStore(
|
|
28
22
|
<Router>
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
</Router>
|
|
23
|
+
<Header />
|
|
24
|
+
</Router>,
|
|
25
|
+
store
|
|
33
26
|
);
|
|
34
27
|
|
|
35
|
-
expect(screen.queryByTestId('
|
|
28
|
+
expect(screen.queryByTestId('logInDialogIcon')).toBeNull();
|
|
36
29
|
expect(screen.getByText('Login')).toBeTruthy();
|
|
37
30
|
expect(screen.queryByTestId('header--button-login')).toBeInTheDocument();
|
|
38
31
|
});
|
|
39
32
|
|
|
40
|
-
test('should load the component in logged in state', () => {
|
|
41
|
-
|
|
33
|
+
test('should load the component in logged in state', async () => {
|
|
34
|
+
renderWithStore(
|
|
42
35
|
<Router>
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
</Router>
|
|
36
|
+
<Header />
|
|
37
|
+
</Router>,
|
|
38
|
+
store
|
|
47
39
|
);
|
|
40
|
+
store.dispatch.login.logInUser({ username: 'store', token: '12345' });
|
|
48
41
|
|
|
49
|
-
|
|
50
|
-
|
|
42
|
+
await waitFor(() => {
|
|
43
|
+
expect(screen.getByTestId('logInDialogIcon')).toBeTruthy();
|
|
44
|
+
expect(screen.queryByText('Login')).toBeNull();
|
|
45
|
+
});
|
|
51
46
|
});
|
|
52
47
|
|
|
53
48
|
test('should open login dialog', async () => {
|
|
54
|
-
|
|
49
|
+
renderWithStore(
|
|
55
50
|
<Router>
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
</Router>
|
|
51
|
+
<Header />
|
|
52
|
+
</Router>,
|
|
53
|
+
store
|
|
60
54
|
);
|
|
61
55
|
|
|
62
|
-
|
|
56
|
+
store.dispatch.login.logOutUser();
|
|
57
|
+
|
|
58
|
+
const loginBtn = screen.getByTestId('header--button-login');
|
|
63
59
|
fireEvent.click(loginBtn);
|
|
64
|
-
const loginDialog = await waitFor(() => getByTestId('login--dialog'));
|
|
60
|
+
const loginDialog = await waitFor(() => screen.getByTestId('login--dialog'));
|
|
65
61
|
expect(loginDialog).toBeTruthy();
|
|
66
62
|
});
|
|
67
63
|
|
|
68
64
|
test('should logout the user', async () => {
|
|
69
|
-
const { getByText, getByTestId } =
|
|
65
|
+
const { getByText, getByTestId } = renderWithStore(
|
|
70
66
|
<Router>
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
</Router>
|
|
67
|
+
<Header />
|
|
68
|
+
</Router>,
|
|
69
|
+
store
|
|
75
70
|
);
|
|
76
71
|
|
|
77
|
-
|
|
72
|
+
store.dispatch.login.logInUser({ username: 'store', token: '12345' });
|
|
73
|
+
|
|
74
|
+
const headerMenuAccountCircle = getByTestId('logInDialogIcon');
|
|
78
75
|
fireEvent.click(headerMenuAccountCircle);
|
|
79
76
|
|
|
80
77
|
// wait for button Logout's appearance and return the element
|
|
@@ -84,12 +81,11 @@ describe('<Header /> component with logged in state', () => {
|
|
|
84
81
|
});
|
|
85
82
|
|
|
86
83
|
test("The question icon should open a new tab of verdaccio's website - installation doc", () => {
|
|
87
|
-
const { getByTestId } =
|
|
84
|
+
const { getByTestId } = renderWithStore(
|
|
88
85
|
<Router>
|
|
89
|
-
<
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
</Router>
|
|
86
|
+
<Header />
|
|
87
|
+
</Router>,
|
|
88
|
+
store
|
|
93
89
|
);
|
|
94
90
|
|
|
95
91
|
const documentationBtn = getByTestId('header--tooltip-documentation');
|
|
@@ -99,12 +95,11 @@ describe('<Header /> component with logged in state', () => {
|
|
|
99
95
|
});
|
|
100
96
|
|
|
101
97
|
test('should open the registrationInfo modal when clicking on the info icon', async () => {
|
|
102
|
-
const { getByTestId } =
|
|
98
|
+
const { getByTestId } = renderWithStore(
|
|
103
99
|
<Router>
|
|
104
|
-
<
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
</Router>
|
|
100
|
+
<Header />
|
|
101
|
+
</Router>,
|
|
102
|
+
store
|
|
108
103
|
);
|
|
109
104
|
|
|
110
105
|
const infoBtn = getByTestId('header--tooltip-info');
|
|
@@ -116,12 +111,11 @@ describe('<Header /> component with logged in state', () => {
|
|
|
116
111
|
});
|
|
117
112
|
|
|
118
113
|
test('should close the registrationInfo modal when clicking on the button close', async () => {
|
|
119
|
-
const { getByTestId, getByText, queryByTestId } =
|
|
114
|
+
const { getByTestId, getByText, queryByTestId } = renderWithStore(
|
|
120
115
|
<Router>
|
|
121
|
-
<
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
</Router>
|
|
116
|
+
<Header />
|
|
117
|
+
</Router>,
|
|
118
|
+
store
|
|
125
119
|
);
|
|
126
120
|
|
|
127
121
|
const infoBtn = getByTestId('header--tooltip-info');
|
|
@@ -138,17 +132,15 @@ describe('<Header /> component with logged in state', () => {
|
|
|
138
132
|
});
|
|
139
133
|
|
|
140
134
|
test('should hide login if is disabled', () => {
|
|
141
|
-
// @ts-expect-error
|
|
142
135
|
window.__VERDACCIO_BASENAME_UI_OPTIONS = {
|
|
143
136
|
base: 'foo',
|
|
144
137
|
login: false,
|
|
145
138
|
};
|
|
146
|
-
|
|
139
|
+
renderWithStore(
|
|
147
140
|
<Router>
|
|
148
|
-
<
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
</Router>
|
|
141
|
+
<Header />
|
|
142
|
+
</Router>,
|
|
143
|
+
store
|
|
152
144
|
);
|
|
153
145
|
|
|
154
146
|
expect(screen.queryByTestId('header--button-login')).not.toBeInTheDocument();
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import React, { useState
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
|
-
|
|
3
|
+
import { useDispatch, useSelector } from 'react-redux';
|
|
4
4
|
import Button from 'verdaccio-ui/components/Button';
|
|
5
5
|
import { useConfig } from 'verdaccio-ui/providers/config';
|
|
6
|
-
import storage from 'verdaccio-ui/utils/storage';
|
|
7
|
-
|
|
8
|
-
import AppContext from '../../App/AppContext';
|
|
9
6
|
|
|
7
|
+
import { Dispatch, RootState } from '../../store/store';
|
|
10
8
|
import HeaderInfoDialog from './HeaderInfoDialog';
|
|
11
9
|
import HeaderLeft from './HeaderLeft';
|
|
12
10
|
import HeaderRight from './HeaderRight';
|
|
13
11
|
import LoginDialog from './LoginDialog';
|
|
14
12
|
import Search from './Search';
|
|
15
|
-
import {
|
|
13
|
+
import { InnerMobileNavBar, InnerNavBar, MobileNavBar, NavBar } from './styles';
|
|
16
14
|
|
|
17
15
|
interface Props {
|
|
18
16
|
withoutSearch?: boolean;
|
|
@@ -21,26 +19,15 @@ interface Props {
|
|
|
21
19
|
/* eslint-disable react/jsx-no-bind*/
|
|
22
20
|
const Header: React.FC<Props> = ({ withoutSearch }) => {
|
|
23
21
|
const { t } = useTranslation();
|
|
24
|
-
const appContext = useContext(AppContext);
|
|
25
22
|
const [isInfoDialogOpen, setOpenInfoDialog] = useState<boolean>(false);
|
|
26
23
|
const [showMobileNavBar, setShowMobileNavBar] = useState<boolean>(false);
|
|
27
24
|
const [showLoginModal, setShowLoginModal] = useState<boolean>(false);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
throw Error(t('app-context-not-correct-used'));
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const { user, scope, setUser } = appContext;
|
|
25
|
+
const loginStore = useSelector((state: RootState) => state.login);
|
|
26
|
+
const configStore = useSelector((state: RootState) => state.configuration.config);
|
|
34
27
|
const { configOptions } = useConfig();
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Logouts user
|
|
38
|
-
* Required by: <Header />
|
|
39
|
-
*/
|
|
28
|
+
const dispatch = useDispatch<Dispatch>();
|
|
40
29
|
const handleLogout = () => {
|
|
41
|
-
|
|
42
|
-
storage.removeItem('token');
|
|
43
|
-
setUser(undefined);
|
|
30
|
+
dispatch.login.logOutUser();
|
|
44
31
|
};
|
|
45
32
|
|
|
46
33
|
return (
|
|
@@ -54,7 +41,7 @@ const Header: React.FC<Props> = ({ withoutSearch }) => {
|
|
|
54
41
|
onOpenRegistryInfoDialog={() => setOpenInfoDialog(true)}
|
|
55
42
|
onToggleLogin={() => setShowLoginModal(!showLoginModal)}
|
|
56
43
|
onToggleMobileNav={() => setShowMobileNavBar(!showMobileNavBar)}
|
|
57
|
-
username={
|
|
44
|
+
username={loginStore?.username}
|
|
58
45
|
withoutSearch={withoutSearch}
|
|
59
46
|
/>
|
|
60
47
|
</InnerNavBar>
|
|
@@ -62,7 +49,7 @@ const Header: React.FC<Props> = ({ withoutSearch }) => {
|
|
|
62
49
|
isOpen={isInfoDialogOpen}
|
|
63
50
|
onCloseDialog={() => setOpenInfoDialog(false)}
|
|
64
51
|
registryUrl={configOptions.base}
|
|
65
|
-
scope={scope}
|
|
52
|
+
scope={configStore.scope}
|
|
66
53
|
/>
|
|
67
54
|
</NavBar>
|
|
68
55
|
{showMobileNavBar && !withoutSearch && (
|
|
@@ -75,7 +62,9 @@ const Header: React.FC<Props> = ({ withoutSearch }) => {
|
|
|
75
62
|
</Button>
|
|
76
63
|
</MobileNavBar>
|
|
77
64
|
)}
|
|
78
|
-
{!
|
|
65
|
+
{!loginStore.username && (
|
|
66
|
+
<LoginDialog onClose={() => setShowLoginModal(false)} open={showLoginModal} />
|
|
67
|
+
)}
|
|
79
68
|
</>
|
|
80
69
|
);
|
|
81
70
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import AccountCircle from '@
|
|
1
|
+
import AccountCircle from '@mui/icons-material/AccountCircle';
|
|
2
2
|
import React, { MouseEvent } from 'react';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
|
-
|
|
5
4
|
import IconButton from 'verdaccio-ui/components/IconButton';
|
|
6
5
|
import Menu from 'verdaccio-ui/components/Menu';
|
|
7
6
|
import MenuItem from 'verdaccio-ui/components/MenuItem';
|
|
@@ -30,9 +29,10 @@ const HeaderMenu: React.FC<Props> = ({
|
|
|
30
29
|
<>
|
|
31
30
|
<IconButton
|
|
32
31
|
color="inherit"
|
|
33
|
-
data-testid="
|
|
32
|
+
data-testid="logInDialogIcon"
|
|
34
33
|
id="header--button-account"
|
|
35
|
-
onClick={onLoggedInMenu}
|
|
34
|
+
onClick={onLoggedInMenu}
|
|
35
|
+
size="large">
|
|
36
36
|
<AccountCircle />
|
|
37
37
|
</IconButton>
|
|
38
38
|
<Menu
|
|
@@ -52,8 +52,8 @@ const HeaderMenu: React.FC<Props> = ({
|
|
|
52
52
|
</MenuItem>
|
|
53
53
|
<MenuItem
|
|
54
54
|
button={true}
|
|
55
|
-
data-testid="
|
|
56
|
-
id="
|
|
55
|
+
data-testid="logOutDialogIcon"
|
|
56
|
+
id="logOutDialogIcon"
|
|
57
57
|
onClick={onLogout}>
|
|
58
58
|
{t('button.logout')}
|
|
59
59
|
</MenuItem>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { MouseEvent, useContext, useEffect, useState } from 'react';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
|
-
|
|
4
3
|
import Button from 'verdaccio-ui/components/Button';
|
|
5
4
|
import ThemeContext from 'verdaccio-ui/design-tokens/ThemeContext';
|
|
6
5
|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import Help from '@
|
|
2
|
-
import Info from '@
|
|
3
|
-
import NightsStay from '@
|
|
4
|
-
import Search from '@
|
|
5
|
-
import WbSunny from '@
|
|
1
|
+
import Help from '@mui/icons-material/Help';
|
|
2
|
+
import Info from '@mui/icons-material/Info';
|
|
3
|
+
import NightsStay from '@mui/icons-material/NightsStay';
|
|
4
|
+
import Search from '@mui/icons-material/Search';
|
|
5
|
+
import WbSunny from '@mui/icons-material/WbSunny';
|
|
6
6
|
import React, { forwardRef } from 'react';
|
|
7
|
-
|
|
8
7
|
import IconButton from 'verdaccio-ui/components/IconButton';
|
|
9
8
|
|
|
10
9
|
import { IconSearchButton, StyledLink } from './styles';
|
|
@@ -30,7 +29,7 @@ const HeaderToolTipIcon = forwardRef<HeaderToolTipIconRef, Props>(function Heade
|
|
|
30
29
|
data-testid={'header--tooltip-documentation'}
|
|
31
30
|
external={true}
|
|
32
31
|
to={'https://verdaccio.org/docs/en/installation'}>
|
|
33
|
-
<IconButton color={'inherit'}>
|
|
32
|
+
<IconButton color={'inherit'} size="large">
|
|
34
33
|
<Help />
|
|
35
34
|
</IconButton>
|
|
36
35
|
</StyledLink>
|
|
@@ -42,7 +41,8 @@ const HeaderToolTipIcon = forwardRef<HeaderToolTipIconRef, Props>(function Heade
|
|
|
42
41
|
data-testid={'header--tooltip-info'}
|
|
43
42
|
id="header--button-registryInfo"
|
|
44
43
|
onClick={onClick}
|
|
45
|
-
ref={ref}
|
|
44
|
+
ref={ref}
|
|
45
|
+
size="large">
|
|
46
46
|
<Info />
|
|
47
47
|
</IconButton>
|
|
48
48
|
);
|
|
@@ -55,7 +55,7 @@ const HeaderToolTipIcon = forwardRef<HeaderToolTipIconRef, Props>(function Heade
|
|
|
55
55
|
case 'dark-mode':
|
|
56
56
|
// todo(Priscila): Add Zoom transition effect
|
|
57
57
|
return (
|
|
58
|
-
<IconButton color="inherit" onClick={onClick} ref={ref}>
|
|
58
|
+
<IconButton color="inherit" onClick={onClick} ref={ref} size="large">
|
|
59
59
|
<NightsStay />
|
|
60
60
|
</IconButton>
|
|
61
61
|
);
|
|
@@ -63,7 +63,7 @@ const HeaderToolTipIcon = forwardRef<HeaderToolTipIconRef, Props>(function Heade
|
|
|
63
63
|
case 'light-mode':
|
|
64
64
|
// todo(Priscila): Add Zoom transition effect
|
|
65
65
|
return (
|
|
66
|
-
<IconButton color="inherit" onClick={onClick} ref={ref}>
|
|
66
|
+
<IconButton color="inherit" onClick={onClick} ref={ref} size="large">
|
|
67
67
|
<WbSunny />
|
|
68
68
|
</IconButton>
|
|
69
69
|
);
|
|
@@ -1,86 +1,24 @@
|
|
|
1
|
+
/* eslint-disable react/jsx-pascal-case */
|
|
1
2
|
import styled from '@emotion/styled';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import i18next
|
|
5
|
-
import React, { useCallback, useContext,
|
|
3
|
+
import LanguageIcon from '@mui/icons-material/Language';
|
|
4
|
+
import withStyles from '@mui/styles/withStyles';
|
|
5
|
+
import i18next from 'i18next';
|
|
6
|
+
import React, { useCallback, useContext, useMemo, useState } from 'react';
|
|
6
7
|
import { useTranslation } from 'react-i18next';
|
|
7
|
-
|
|
8
8
|
import { AutoComplete } from 'verdaccio-ui/components/AutoComplete/AutoCompleteV2';
|
|
9
|
-
import {
|
|
10
|
-
France,
|
|
11
|
-
Brazil,
|
|
12
|
-
Germany,
|
|
13
|
-
Spain,
|
|
14
|
-
China,
|
|
15
|
-
Russia,
|
|
16
|
-
Turkey,
|
|
17
|
-
Ukraine,
|
|
18
|
-
Khmer,
|
|
19
|
-
Japan,
|
|
20
|
-
Usa,
|
|
21
|
-
Czech,
|
|
22
|
-
Taiwan,
|
|
23
|
-
} from 'verdaccio-ui/components/Icons';
|
|
24
9
|
import MenuItem from 'verdaccio-ui/components/MenuItem';
|
|
25
|
-
import { Theme } from 'verdaccio-ui/design-tokens/theme';
|
|
26
10
|
import ThemeContext from 'verdaccio-ui/design-tokens/ThemeContext';
|
|
11
|
+
import { Theme } from 'verdaccio-ui/design-tokens/theme';
|
|
27
12
|
|
|
28
|
-
import { Language } from '
|
|
13
|
+
import { Language, listLanguages } from '../../i18n/enabledLanguages';
|
|
29
14
|
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
translation:
|
|
33
|
-
icon:
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
icon: <Brazil size="md" />,
|
|
38
|
-
},
|
|
39
|
-
'de-DE': {
|
|
40
|
-
translation: 'lng.german',
|
|
41
|
-
icon: <Germany size="md" />,
|
|
42
|
-
},
|
|
43
|
-
'es-ES': {
|
|
44
|
-
translation: 'lng.spanish',
|
|
45
|
-
icon: <Spain size="md" />,
|
|
46
|
-
},
|
|
47
|
-
'zh-CN': {
|
|
48
|
-
translation: 'lng.chinese',
|
|
49
|
-
icon: <China size="md" />,
|
|
50
|
-
},
|
|
51
|
-
'ru-RU': {
|
|
52
|
-
translation: 'lng.russian',
|
|
53
|
-
icon: <Russia size="md" />,
|
|
54
|
-
},
|
|
55
|
-
'tr-TR': {
|
|
56
|
-
translation: 'lng.turkish',
|
|
57
|
-
icon: <Turkey size="md" />,
|
|
58
|
-
},
|
|
59
|
-
'uk-UA': {
|
|
60
|
-
translation: 'lng.ukraine',
|
|
61
|
-
icon: <Ukraine size="md" />,
|
|
62
|
-
},
|
|
63
|
-
'km-KH': {
|
|
64
|
-
translation: 'lng.khmer',
|
|
65
|
-
icon: <Khmer size="md" />,
|
|
66
|
-
},
|
|
67
|
-
'ja-JP': {
|
|
68
|
-
translation: 'lng.japanese',
|
|
69
|
-
icon: <Japan size="md" />,
|
|
70
|
-
},
|
|
71
|
-
'en-US': {
|
|
72
|
-
translation: 'lng.english',
|
|
73
|
-
icon: <Usa size="md" />,
|
|
74
|
-
},
|
|
75
|
-
'cs-CZ': {
|
|
76
|
-
translation: 'lng.czech',
|
|
77
|
-
icon: <Czech size="md" />,
|
|
78
|
-
},
|
|
79
|
-
'zh-TW': {
|
|
80
|
-
translation: 'lng.chineseTraditional',
|
|
81
|
-
icon: <Taiwan size="md" />,
|
|
82
|
-
},
|
|
83
|
-
};
|
|
15
|
+
const listConverted = listLanguages.reduce((prev, item) => {
|
|
16
|
+
prev[item.lng] = {
|
|
17
|
+
translation: item.menuKey,
|
|
18
|
+
icon: item.icon,
|
|
19
|
+
};
|
|
20
|
+
return prev;
|
|
21
|
+
}, {});
|
|
84
22
|
|
|
85
23
|
const LanguageSwitch = () => {
|
|
86
24
|
const themeContext = useContext(ThemeContext);
|
|
@@ -104,10 +42,10 @@ const LanguageSwitch = () => {
|
|
|
104
42
|
|
|
105
43
|
const getCurrentLngDetails = useCallback(
|
|
106
44
|
(language: Language) => {
|
|
107
|
-
const
|
|
45
|
+
const lng = listConverted[language] || listConverted['en-US'];
|
|
108
46
|
return {
|
|
109
|
-
icon
|
|
110
|
-
translation: t(translation),
|
|
47
|
+
icon: <lng.icon />,
|
|
48
|
+
translation: t(lng.translation),
|
|
111
49
|
};
|
|
112
50
|
},
|
|
113
51
|
[t]
|
|
@@ -1,24 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
2
|
import api from 'verdaccio-ui/providers/API/api';
|
|
4
3
|
import {
|
|
5
|
-
|
|
6
|
-
waitFor,
|
|
7
|
-
fireEvent,
|
|
4
|
+
act,
|
|
8
5
|
cleanup,
|
|
6
|
+
fireEvent,
|
|
7
|
+
renderWithStore,
|
|
9
8
|
screen,
|
|
10
|
-
|
|
9
|
+
waitFor,
|
|
11
10
|
} from 'verdaccio-ui/utils/test-react-testing-library';
|
|
12
11
|
|
|
13
|
-
import
|
|
14
|
-
|
|
12
|
+
import { store } from '../../../store';
|
|
15
13
|
import LoginDialog from './LoginDialog';
|
|
16
14
|
|
|
17
|
-
const appContextValue: AppContextProps = {
|
|
18
|
-
scope: '',
|
|
19
|
-
setUser: jest.fn(),
|
|
20
|
-
};
|
|
21
|
-
|
|
22
15
|
describe('<LoginDialog /> component', () => {
|
|
23
16
|
beforeEach(() => {
|
|
24
17
|
jest.resetModules();
|
|
@@ -30,11 +23,7 @@ describe('<LoginDialog /> component', () => {
|
|
|
30
23
|
const props = {
|
|
31
24
|
onClose: jest.fn(),
|
|
32
25
|
};
|
|
33
|
-
const { container } =
|
|
34
|
-
<AppContext.Provider value={appContextValue}>
|
|
35
|
-
<LoginDialog onClose={props.onClose} />
|
|
36
|
-
</AppContext.Provider>
|
|
37
|
-
);
|
|
26
|
+
const { container } = renderWithStore(<LoginDialog onClose={props.onClose} />, store);
|
|
38
27
|
expect(container.firstChild).toMatchSnapshot();
|
|
39
28
|
});
|
|
40
29
|
|
|
@@ -44,10 +33,9 @@ describe('<LoginDialog /> component', () => {
|
|
|
44
33
|
onClose: jest.fn(),
|
|
45
34
|
};
|
|
46
35
|
|
|
47
|
-
const { getByTestId } =
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
</AppContext.Provider>
|
|
36
|
+
const { getByTestId } = renderWithStore(
|
|
37
|
+
<LoginDialog onClose={props.onClose} open={props.open} />,
|
|
38
|
+
store
|
|
51
39
|
);
|
|
52
40
|
|
|
53
41
|
const loginDialogHeading = await waitFor(() => getByTestId('login-dialog-form-login-button'));
|
|
@@ -60,18 +48,18 @@ describe('<LoginDialog /> component', () => {
|
|
|
60
48
|
onClose: jest.fn(),
|
|
61
49
|
};
|
|
62
50
|
|
|
63
|
-
const { getByTestId } =
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
</AppContext.Provider>
|
|
51
|
+
const { getByTestId } = renderWithStore(
|
|
52
|
+
<LoginDialog onClose={props.onClose} open={props.open} />,
|
|
53
|
+
store
|
|
67
54
|
);
|
|
68
55
|
|
|
69
56
|
const loginDialogButton = await waitFor(() => getByTestId('close-login-dialog-button'));
|
|
70
57
|
expect(loginDialogButton).toBeTruthy();
|
|
71
58
|
|
|
72
|
-
act(() => {
|
|
59
|
+
await act(() => {
|
|
73
60
|
fireEvent.click(loginDialogButton, { open: false });
|
|
74
61
|
});
|
|
62
|
+
|
|
75
63
|
expect(props.onClose).toHaveBeenCalled();
|
|
76
64
|
});
|
|
77
65
|
|
|
@@ -88,11 +76,9 @@ describe('<LoginDialog /> component', () => {
|
|
|
88
76
|
})
|
|
89
77
|
);
|
|
90
78
|
|
|
91
|
-
|
|
92
|
-
<
|
|
93
|
-
|
|
94
|
-
</AppContext.Provider>
|
|
95
|
-
);
|
|
79
|
+
await act(async () => {
|
|
80
|
+
renderWithStore(<LoginDialog onClose={props.onClose} open={props.open} />, store);
|
|
81
|
+
});
|
|
96
82
|
|
|
97
83
|
const userNameInput = screen.getByPlaceholderText('Your username');
|
|
98
84
|
expect(userNameInput).toBeInTheDocument();
|
|
@@ -104,13 +90,17 @@ describe('<LoginDialog /> component', () => {
|
|
|
104
90
|
const passwordInput = screen.getByPlaceholderText('Your strong password');
|
|
105
91
|
expect(userNameInput).toBeInTheDocument();
|
|
106
92
|
fireEvent.focus(passwordInput);
|
|
107
|
-
fireEvent.change(passwordInput, { target: { value: '1234' } });
|
|
108
93
|
|
|
109
|
-
act(async () => {
|
|
110
|
-
|
|
111
|
-
|
|
94
|
+
await act(async () => {
|
|
95
|
+
fireEvent.change(passwordInput, { target: { value: '1234' } });
|
|
96
|
+
});
|
|
97
|
+
const signInButton = screen.getByTestId('login-dialog-form-login-button');
|
|
98
|
+
expect(signInButton).not.toBeDisabled();
|
|
99
|
+
|
|
100
|
+
await act(async () => {
|
|
112
101
|
fireEvent.click(signInButton);
|
|
113
102
|
});
|
|
103
|
+
expect(props.onClose).toHaveBeenCalledTimes(1);
|
|
114
104
|
});
|
|
115
105
|
|
|
116
106
|
test.todo('validateCredentials: should validate credentials');
|