@verdaccio/ui-components 3.0.0-next-7.7 → 3.0.0-next-7.8
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/.eslintrc +1 -1
- package/CHANGELOG.md +6 -0
- package/build/Theme/theme.js +3 -3
- package/build/components/ActionBar/ActionBar.js +3 -1
- package/build/components/ActionBar/ActionBarAction.js +7 -6
- package/build/components/Author/Author.js +13 -42
- package/build/components/CopyClipboard/utils.js +3 -12
- package/build/components/Dependencies/Dependencies.js +12 -13
- package/build/components/Dependencies/DependencyBlock.js +5 -4
- package/build/components/Developers/DeveloperType.js +12 -0
- package/build/components/Developers/Developers.js +20 -22
- package/build/components/Developers/Title.js +5 -9
- package/build/components/Developers/index.js +4 -4
- package/build/components/Distribution/Dist.js +1 -1
- package/build/components/Distribution/styles.js +10 -23
- package/build/components/Engines/Engines.js +7 -1
- package/build/components/Engines/styles.js +6 -6
- package/build/components/FundButton/FundButton.js +7 -8
- package/build/components/HeaderInfoDialog/HeaderInfoDialog.js +2 -1
- package/build/components/Icons/DevsIcons/CommonJS.js +1 -12
- package/build/components/Icons/DevsIcons/ES6Module.js +2 -13
- package/build/components/Icons/DevsIcons/Git.js +1 -12
- package/build/components/Icons/DevsIcons/NodeJS.js +1 -12
- package/build/components/Icons/DevsIcons/TypeScript.js +1 -12
- package/build/components/Icons/FileBinary.js +11 -5
- package/build/components/Icons/Law.js +12 -6
- package/build/components/Icons/Managers/Npm.js +1 -12
- package/build/components/Icons/Managers/Pnpm.js +1 -12
- package/build/components/Icons/Managers/Yarn.js +1 -12
- package/build/components/Install/Install.js +23 -18
- package/build/components/Install/InstallListItem.js +19 -18
- package/build/components/Keywords/KeywordListItems.js +34 -0
- package/build/components/Keywords/Keywords.js +39 -0
- package/build/{sections/Header/RegistryInfoDialog → components/Keywords}/index.js +2 -2
- package/build/components/Link/Link.js +4 -16
- package/build/components/Link/index.js +1 -1
- package/build/components/LinkExternal/LinkExternal.js +32 -0
- package/build/components/LinkExternal/index.js +14 -0
- package/build/components/Loading/styles.js +3 -2
- package/build/components/LoginDialog/LoginDialog.js +12 -1
- package/build/components/LoginDialog/LoginDialogCloseButton.js +3 -2
- package/build/components/LoginDialog/LoginDialogForm.js +2 -14
- package/build/components/LoginDialog/LoginDialogFormError.js +3 -2
- package/build/components/Logo/Logo.js +13 -6
- package/build/components/Package/Package.js +43 -34
- package/build/components/Package/styles.js +46 -58
- package/build/components/Person/Person.js +48 -0
- package/build/components/Person/PersonTooltip.js +22 -0
- package/build/components/{Package/Tag → Person}/index.js +2 -2
- package/build/components/Person/utils.js +17 -0
- package/build/components/RawViewer/RawViewer.js +11 -5
- package/build/components/Readme/Readme.js +15 -6
- package/build/components/Readme/Readme.js.map +1 -1
- package/build/components/Readme/Readme.spec.js +19 -0
- package/build/components/Readme/Readme.spec.js.map +1 -1
- package/build/components/Readme/utils.js +2 -5
- package/build/components/RegistryInfoDialog/styles.js +9 -10
- package/build/components/Repository/Repository.js +19 -31
- package/build/components/Search/AutoComplete/styles.js +4 -41
- package/build/components/Search/Search.js +4 -2
- package/build/components/Search/SearchItem.js +51 -38
- package/build/components/Search/utils.js +23 -0
- package/build/components/SettingsMenu/SettingsMenu.js +35 -9
- package/build/components/SideBarTitle/SideBarTitle.js +16 -6
- package/build/components/UpLinks/UpLinks.js +35 -6
- package/build/components/UpLinks/UplinkLink.js +22 -0
- package/build/components/UpLinks/styles.js +5 -4
- package/build/components/Versions/HistoryList.js +8 -5
- package/build/components/Versions/TagList.js +8 -4
- package/build/components/Versions/Versions.js +30 -7
- package/build/index.js +27 -3
- package/build/providers/AppConfigurationProvider/AppConfigurationProvider.js +1 -0
- package/build/providers/PersistenceSettingProvider/PersistenceSettingProvider.js +1 -0
- package/build/sections/Detail/Detail.js +6 -2
- package/build/sections/Detail/Tabs.js +4 -3
- package/build/sections/Footer/Footer.js +17 -8
- package/build/sections/Footer/styles.js +13 -10
- package/build/sections/Header/HeaderLeft.js +14 -17
- package/build/sections/Header/HeaderMenu.js +1 -1
- package/build/sections/Header/HeaderRight.js +12 -3
- package/build/sections/Header/HeaderSettingsDialog.js +2 -2
- package/build/sections/Header/styles.js +43 -82
- package/build/sections/SideBar/Sidebar.js +10 -15
- package/build/src/Theme/ThemeProvider.test.d.ts +1 -0
- package/build/src/components/Author/Author.d.ts +0 -5
- package/build/src/components/CopyClipboard/CopyToClipBoard.test.d.ts +1 -0
- package/build/src/components/Dependencies/Dependencies.d.ts +0 -1
- package/build/src/components/Developers/DeveloperType.d.ts +4 -0
- package/build/src/components/Developers/Developers.d.ts +1 -4
- package/build/src/components/Developers/Title.d.ts +1 -4
- package/build/src/components/Developers/index.d.ts +2 -1
- package/build/src/components/Distribution/styles.d.ts +0 -1
- package/build/src/components/ErrorBoundary/ErrorBoundary.test.d.ts +1 -0
- package/build/src/components/HeaderInfoDialog/HeaderInfoDialog.test.d.ts +1 -0
- package/build/src/components/Heading/Heading.test.d.ts +1 -0
- package/build/src/components/Icons/Icons.test.d.ts +1 -0
- package/build/src/components/Install/InstallListItem.d.ts +1 -1
- package/build/src/components/Keywords/KeywordListItems.d.ts +5 -0
- package/build/src/components/Keywords/Keywords.d.ts +6 -0
- package/build/src/components/Keywords/Keywords.stories.d.ts +5 -0
- package/build/src/components/Keywords/Keywords.test.d.ts +1 -0
- package/build/src/components/Keywords/index.d.ts +1 -0
- package/build/src/components/Link/Link.d.ts +0 -3
- package/build/src/components/Link/Link.test.d.ts +1 -0
- package/build/src/components/Link/index.d.ts +1 -1
- package/build/src/components/LinkExternal/LinkExternal.d.ts +3 -0
- package/build/src/components/LinkExternal/LinkExternal.test.d.ts +1 -0
- package/build/src/components/LinkExternal/index.d.ts +1 -0
- package/build/src/components/Logo/Logo.d.ts +1 -0
- package/build/src/components/Logo/Logo.stories.d.ts +5 -0
- package/build/src/components/Package/Package.d.ts +1 -1
- package/build/src/components/Package/styles.d.ts +0 -8
- package/build/src/components/Person/Person.d.ts +9 -0
- package/build/src/components/Person/Person.test.d.ts +1 -0
- package/build/src/components/Person/PersonTooltip.d.ts +6 -0
- package/build/src/components/Person/index.d.ts +1 -0
- package/build/src/components/Person/utils.d.ts +3 -0
- package/build/src/components/Readme/Readme.d.ts +0 -1
- package/build/src/components/Search/AutoComplete/styles.d.ts +0 -8
- package/build/src/components/Search/utils.d.ts +1 -0
- package/build/src/components/SettingsMenu/SettingsMenu.d.ts +2 -2
- package/build/src/components/SettingsMenu/SettingsMenu.test.d.ts +1 -0
- package/build/src/components/UpLinks/UplinkLink.d.ts +6 -0
- package/build/src/components/Versions/Versions.d.ts +1 -0
- package/build/src/index.d.ts +4 -1
- package/build/src/sections/Detail/Tabs.d.ts +1 -0
- package/build/src/sections/Header/styles.d.ts +0 -7
- package/build/src/store/models/routes.d.ts +8 -0
- package/build/src/store/models/utils.d.ts +1 -0
- package/build/src/types/packageMeta.d.ts +7 -5
- package/build/src/utils/routes.d.ts +1 -0
- package/build/src/utils/utils.d.ts +1 -0
- package/build/store/models/configuration.js +2 -1
- package/build/store/models/login.js +4 -2
- package/build/store/models/manifest.js +5 -3
- package/build/store/models/packages.js +4 -2
- package/build/store/models/routes.js +18 -0
- package/build/store/models/search.js +4 -2
- package/build/store/models/utils.js +10 -0
- package/build/utils/routes.js +1 -0
- package/build/utils/utils.js +20 -1
- package/package.json +2 -2
- package/src/AppTest/AppRoute.test.tsx +65 -0
- package/src/Theme/ThemeProvider.test.tsx +27 -0
- package/src/Theme/theme.ts +3 -3
- package/src/components/ActionBar/ActionBar.test.tsx +36 -15
- package/src/components/ActionBar/ActionBar.tsx +1 -1
- package/src/components/ActionBar/ActionBarAction.tsx +8 -5
- package/src/components/Author/Author.test.tsx +7 -1
- package/src/components/Author/Author.tsx +3 -41
- package/src/components/CopyClipboard/CopyToClipBoard.test.tsx +23 -0
- package/src/components/CopyClipboard/utils.ts +2 -13
- package/src/components/Dependencies/Dependencies.tsx +9 -9
- package/src/components/Dependencies/DependencyBlock.tsx +2 -1
- package/src/components/Developers/DeveloperType.tsx +4 -0
- package/src/components/Developers/Developers.test.tsx +37 -10
- package/src/components/Developers/Developers.tsx +13 -13
- package/src/components/Developers/Title.tsx +1 -5
- package/src/components/Developers/index.ts +2 -1
- package/src/components/Distribution/Dist.test.tsx +1 -1
- package/src/components/Distribution/Dist.tsx +2 -4
- package/src/components/Distribution/styles.ts +0 -6
- package/src/components/Engines/Engines.tsx +6 -2
- package/src/components/Engines/styles.ts +1 -1
- package/src/components/ErrorBoundary/ErrorBoundary.test.tsx +39 -0
- package/src/components/FundButton/FundButton.tsx +5 -5
- package/src/components/HeaderInfoDialog/HeaderInfoDialog.test.tsx +51 -0
- package/src/components/HeaderInfoDialog/HeaderInfoDialog.tsx +2 -2
- package/src/components/Heading/Heading.test.tsx +20 -0
- package/src/components/Icons/DevsIcons/CommonJS.tsx +1 -7
- package/src/components/Icons/DevsIcons/ES6Module.tsx +2 -8
- package/src/components/Icons/DevsIcons/Git.tsx +1 -7
- package/src/components/Icons/DevsIcons/NodeJS.tsx +1 -7
- package/src/components/Icons/DevsIcons/TypeScript.tsx +1 -7
- package/src/components/Icons/FileBinary.tsx +2 -1
- package/src/components/Icons/Icons.stories.tsx +21 -5
- package/src/components/Icons/Icons.test.tsx +70 -0
- package/src/components/Icons/Law.tsx +2 -1
- package/src/components/Icons/Managers/Npm.tsx +1 -7
- package/src/components/Icons/Managers/Pnpm.tsx +1 -7
- package/src/components/Icons/Managers/Yarn.tsx +1 -7
- package/src/components/Install/Install.test.tsx +54 -13
- package/src/components/Install/Install.tsx +12 -11
- package/src/components/Install/InstallListItem.tsx +12 -11
- package/src/components/Keywords/KeywordListItems.tsx +22 -0
- package/src/components/Keywords/Keywords.stories.tsx +19 -0
- package/src/components/Keywords/Keywords.test.tsx +57 -0
- package/src/components/Keywords/Keywords.tsx +35 -0
- package/src/components/Keywords/index.ts +1 -0
- package/src/components/Link/Link.test.tsx +25 -0
- package/src/components/Link/Link.tsx +4 -18
- package/src/components/Link/index.ts +1 -1
- package/src/components/LinkExternal/LinkExternal.test.tsx +18 -0
- package/src/components/LinkExternal/LinkExternal.tsx +22 -0
- package/src/components/LinkExternal/index.ts +1 -0
- package/src/components/Loading/Loading.test.tsx +8 -5
- package/src/components/Loading/styles.ts +1 -0
- package/src/components/LoginDialog/LoginDialog.test.tsx +1 -1
- package/src/components/LoginDialog/LoginDialog.tsx +10 -1
- package/src/components/LoginDialog/LoginDialogCloseButton.tsx +1 -0
- package/src/components/LoginDialog/LoginDialogForm.tsx +0 -2
- package/src/components/LoginDialog/LoginDialogFormError.tsx +1 -1
- package/src/components/Logo/Logo.stories.tsx +16 -0
- package/src/components/Logo/Logo.test.tsx +8 -1
- package/src/components/Logo/Logo.tsx +19 -3
- package/src/components/Package/Package.test.tsx +47 -14
- package/src/components/Package/Package.tsx +41 -44
- package/src/components/Package/styles.ts +7 -17
- package/src/components/PackageList/Packagelist.test.tsx +1 -0
- package/src/components/Person/Person.test.tsx +50 -0
- package/src/components/Person/Person.tsx +45 -0
- package/src/components/Person/PersonTooltip.tsx +26 -0
- package/src/components/Person/index.ts +1 -0
- package/src/components/Person/utils.ts +20 -0
- package/src/components/RawViewer/RawViewer.tsx +8 -4
- package/src/components/Readme/Readme.spec.tsx +17 -0
- package/src/components/Readme/Readme.tsx +10 -5
- package/src/components/Readme/utils.ts +2 -5
- package/src/components/RegistryInfoDialog/styles.ts +5 -4
- package/src/components/Repository/Repository.tsx +9 -14
- package/src/components/Search/AutoComplete/styles.ts +7 -0
- package/src/components/Search/Search.test.tsx +36 -9
- package/src/components/Search/Search.tsx +4 -2
- package/src/components/Search/SearchItem.tsx +19 -8
- package/src/components/Search/utils.ts +17 -0
- package/src/components/SettingsMenu/SettingsMenu.test.tsx +41 -0
- package/src/components/SettingsMenu/SettingsMenu.tsx +48 -10
- package/src/components/SideBarTitle/SideBarTitle.tsx +19 -3
- package/src/components/UpLinks/UpLinks.test.tsx +7 -0
- package/src/components/UpLinks/UpLinks.tsx +38 -15
- package/src/components/UpLinks/UplinkLink.tsx +20 -0
- package/src/components/UpLinks/styles.ts +1 -0
- package/src/components/Versions/HistoryList.tsx +9 -4
- package/src/components/Versions/TagList.tsx +4 -3
- package/src/components/Versions/Versions.test.tsx +2 -0
- package/src/components/Versions/Versions.tsx +57 -32
- package/src/index.ts +4 -1
- package/src/providers/AppConfigurationProvider/AppConfigurationProvider.tsx +1 -0
- package/src/providers/PersistenceSettingProvider/PersistenceSettingProvider.tsx +2 -0
- package/src/providers/VersionProvider/VersionProvider.test.tsx +3 -3
- package/src/sections/Detail/Detail.test.tsx +8 -1
- package/src/sections/Detail/Detail.tsx +11 -4
- package/src/sections/Detail/Tabs.tsx +5 -2
- package/src/sections/Footer/Footer.tsx +15 -4
- package/src/sections/Footer/styles.ts +4 -0
- package/src/sections/Header/Header.test.tsx +12 -10
- package/src/sections/Header/HeaderLeft.tsx +19 -11
- package/src/sections/Header/HeaderMenu.tsx +1 -1
- package/src/sections/Header/HeaderRight.tsx +14 -3
- package/src/sections/Header/HeaderSettingsDialog.tsx +1 -1
- package/src/sections/Header/RegistryInfoContent/RegistryInfoContent.test.tsx +1 -1
- package/src/sections/Header/styles.ts +4 -16
- package/src/sections/Home/Home.test.tsx +12 -4
- package/src/sections/SideBar/Sidebar.test.tsx +20 -13
- package/src/sections/SideBar/Sidebar.tsx +5 -9
- package/src/store/api.test.ts +16 -0
- package/src/store/models/configuration.ts +2 -1
- package/src/store/models/login.ts +10 -12
- package/src/store/models/manifest.ts +6 -5
- package/src/store/models/packages.ts +4 -5
- package/src/store/models/routes.ts +10 -0
- package/src/store/models/search.ts +4 -2
- package/src/store/models/utils.ts +3 -0
- package/src/types/packageMeta.ts +7 -5
- package/src/utils/routes.ts +1 -0
- package/src/utils/utils.test.ts +34 -0
- package/src/utils/utils.ts +20 -5
- package/tsconfig.json +1 -1
- package/build/components/Developers/styles.js +0 -65
- package/build/components/Distribution/utils.js +0 -25
- package/build/components/Distribution/utilts.spec.js +0 -18
- package/build/components/Package/Tag/Tag.js +0 -14
- package/build/components/Package/Tag/styles.js +0 -24
- package/build/sections/Header/RegistryInfoDialog/RegistryInfoDialog.js +0 -36
- package/build/sections/Header/RegistryInfoDialog/styles.js +0 -46
- package/build/sections/Header/RegistryInfoDialog/types.js +0 -6
- package/build/src/components/Developers/styles.d.ts +0 -11
- package/build/src/components/Distribution/utils.d.ts +0 -7
- package/build/src/components/Package/Tag/Tag.d.ts +0 -6
- package/build/src/components/Package/Tag/index.d.ts +0 -1
- package/build/src/components/Package/Tag/styles.d.ts +0 -5
- package/build/src/sections/Header/RegistryInfoDialog/RegistryInfoDialog.d.ts +0 -4
- package/build/src/sections/Header/RegistryInfoDialog/index.d.ts +0 -1
- package/build/src/sections/Header/RegistryInfoDialog/styles.d.ts +0 -13
- package/build/src/sections/Header/RegistryInfoDialog/types.d.ts +0 -7
- package/src/components/Developers/styles.ts +0 -31
- package/src/components/Distribution/utils.ts +0 -32
- package/src/components/Distribution/utilts.spec.ts +0 -17
- package/src/components/Package/Tag/Tag.test.tsx +0 -15
- package/src/components/Package/Tag/Tag.tsx +0 -11
- package/src/components/Package/Tag/index.ts +0 -1
- package/src/components/Package/Tag/styles.ts +0 -11
- package/src/components/Search/AutoComplete/styles.tsx +0 -42
- package/src/sections/Header/RegistryInfoDialog/RegistryInfoDialog.tsx +0 -31
- package/src/sections/Header/RegistryInfoDialog/index.ts +0 -1
- package/src/sections/Header/RegistryInfoDialog/styles.ts +0 -21
- package/src/sections/Header/RegistryInfoDialog/types.ts +0 -8
- /package/build/components/Icons/DevsIcons/{es6modules.svg → es6module.svg} +0 -0
- /package/build/src/{components/Package/Tag/Tag.test.d.ts → AppTest/AppRoute.test.d.ts} +0 -0
- /package/src/components/Icons/DevsIcons/{es6modules.svg → es6module.svg} +0 -0
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import styled from '@emotion/styled';
|
|
1
2
|
import Alert from '@mui/material/Alert';
|
|
3
|
+
import Box from '@mui/material/Box';
|
|
4
|
+
import Card from '@mui/material/Card';
|
|
5
|
+
import CardContent from '@mui/material/CardContent';
|
|
2
6
|
import TextField from '@mui/material/TextField';
|
|
3
7
|
import Typography from '@mui/material/Typography';
|
|
4
8
|
import { useTheme } from '@mui/styles';
|
|
@@ -7,12 +11,18 @@ import React, { useState } from 'react';
|
|
|
7
11
|
import { useTranslation } from 'react-i18next';
|
|
8
12
|
import semver from 'semver';
|
|
9
13
|
|
|
14
|
+
import { Theme } from '../../Theme';
|
|
10
15
|
import { useConfig } from '../../providers';
|
|
11
16
|
import VersionsHistoryList from './HistoryList';
|
|
12
17
|
import VersionsTagList from './TagList';
|
|
13
18
|
|
|
14
19
|
export type Props = { packageMeta: any; packageName: string };
|
|
15
20
|
|
|
21
|
+
export const StyledText = styled(Typography)<{ theme?: Theme }>((props) => ({
|
|
22
|
+
fontWeight: props.theme && props.theme.fontWeight.bold,
|
|
23
|
+
textTransform: 'capitalize',
|
|
24
|
+
}));
|
|
25
|
+
|
|
16
26
|
const Versions: React.FC<Props> = ({ packageMeta, packageName }) => {
|
|
17
27
|
const { t } = useTranslation();
|
|
18
28
|
const { configOptions } = useConfig();
|
|
@@ -46,38 +56,53 @@ const Versions: React.FC<Props> = ({ packageMeta, packageName }) => {
|
|
|
46
56
|
};
|
|
47
57
|
|
|
48
58
|
return (
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
59
|
+
<Card sx={{ mb: 2 }}>
|
|
60
|
+
<CardContent>
|
|
61
|
+
<Box data-testid="versions" sx={{ m: 2 }}>
|
|
62
|
+
{hasDistTags ? (
|
|
63
|
+
<>
|
|
64
|
+
<StyledText variant="subtitle1">
|
|
65
|
+
{t('versions.current-tags')}
|
|
66
|
+
<span>{` (${Object.keys(distTags).length})`}</span>
|
|
67
|
+
</StyledText>
|
|
68
|
+
<VersionsTagList packageName={packageName} tags={distTags} time={time} />
|
|
69
|
+
</>
|
|
70
|
+
) : null}
|
|
71
|
+
<>
|
|
72
|
+
<StyledText variant="subtitle1">
|
|
73
|
+
{t('versions.version-history')}
|
|
74
|
+
<span>{` (${Object.keys(packageVersions).length})`}</span>
|
|
75
|
+
</StyledText>
|
|
76
|
+
<TextField
|
|
77
|
+
helperText={t('versions.search.placeholder')}
|
|
78
|
+
onChange={debounce((e) => {
|
|
79
|
+
filterVersions(e.target.value);
|
|
80
|
+
}, 200)}
|
|
81
|
+
size="small"
|
|
82
|
+
variant="standard"
|
|
83
|
+
width="50%"
|
|
84
|
+
/>
|
|
85
|
+
</>
|
|
86
|
+
{hasVersionHistory ? (
|
|
87
|
+
<>
|
|
88
|
+
{hideDeprecatedVersions === true && (
|
|
89
|
+
<Alert
|
|
90
|
+
severity="info"
|
|
91
|
+
sx={{ marginTop: theme.spacing(1), marginBottom: theme.spacing(1) }}
|
|
92
|
+
>
|
|
93
|
+
{t('versions.hide-deprecated')}
|
|
94
|
+
</Alert>
|
|
95
|
+
)}
|
|
96
|
+
<VersionsHistoryList
|
|
97
|
+
packageName={packageName}
|
|
98
|
+
time={time}
|
|
99
|
+
versions={packageVersions}
|
|
100
|
+
/>
|
|
101
|
+
</>
|
|
102
|
+
) : null}
|
|
103
|
+
</Box>
|
|
104
|
+
</CardContent>
|
|
105
|
+
</Card>
|
|
81
106
|
);
|
|
82
107
|
};
|
|
83
108
|
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { default as CopyClipboard, copyToClipBoardUtility } from './components/CopyClipboard';
|
|
2
2
|
export * from './components/CopyClipboard';
|
|
3
|
-
export { Link } from './components/Link';
|
|
4
3
|
export { default as ActionBar } from './components/ActionBar';
|
|
5
4
|
export { default as Author } from './components/Author';
|
|
6
5
|
export { default as Dependencies } from './components/Dependencies';
|
|
@@ -12,7 +11,11 @@ export { default as FundButton } from './components/FundButton';
|
|
|
12
11
|
export { default as Heading } from './components/Heading';
|
|
13
12
|
export * as Icons from './components/Icons';
|
|
14
13
|
export { default as Install } from './components/Install';
|
|
14
|
+
export { default as Keywords } from './components/Keywords';
|
|
15
|
+
export { default as Link } from './components/Link';
|
|
16
|
+
export { default as LinkExternal } from './components/LinkExternal';
|
|
15
17
|
export { default as RawViewer } from './components/RawViewer';
|
|
18
|
+
export { default as Person } from './components/Person';
|
|
16
19
|
export { default as Readme } from './components/Readme';
|
|
17
20
|
export { default as SideBarTitle } from './components/SideBarTitle';
|
|
18
21
|
export { default as UpLinks } from './components/UpLinks';
|
|
@@ -10,11 +10,13 @@ import React, {
|
|
|
10
10
|
import useLocalStorage from '../../hooks/useLocalStorage';
|
|
11
11
|
|
|
12
12
|
type PersistenceSettingsProps = {
|
|
13
|
+
isLatest?: boolean;
|
|
13
14
|
isGlobal?: boolean;
|
|
14
15
|
yarnModern: boolean;
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
const defaultValues: PersistenceSettingsProps = {
|
|
19
|
+
isLatest: false,
|
|
18
20
|
isGlobal: false,
|
|
19
21
|
yarnModern: false,
|
|
20
22
|
};
|
|
@@ -30,7 +30,7 @@ describe('<Header /> component with logged in state', () => {
|
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
test('should load data from the provider', async () => {
|
|
33
|
-
|
|
33
|
+
act(() =>
|
|
34
34
|
renderWithStore(
|
|
35
35
|
<MemoryRouter initialEntries={[`/-/web/detail/storybook`]}>
|
|
36
36
|
<Route path={Routes.PACKAGE}>
|
|
@@ -40,8 +40,8 @@ describe('<Header /> component with logged in state', () => {
|
|
|
40
40
|
</Route>
|
|
41
41
|
</MemoryRouter>,
|
|
42
42
|
store
|
|
43
|
-
)
|
|
44
|
-
|
|
43
|
+
)
|
|
44
|
+
);
|
|
45
45
|
await waitFor(() => screen.getByText('storybook'));
|
|
46
46
|
expect(screen.getByText('storybook')).toBeInTheDocument();
|
|
47
47
|
expect(screen.getByText('MIT')).toBeInTheDocument();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { render } from '../../test/test-react-testing-library';
|
|
3
|
+
import { render, screen } from '../../test/test-react-testing-library';
|
|
4
4
|
import DetailContainer from './Detail';
|
|
5
5
|
|
|
6
6
|
describe('DetailContainer', () => {
|
|
@@ -8,5 +8,12 @@ describe('DetailContainer', () => {
|
|
|
8
8
|
const { container } = render(<DetailContainer />);
|
|
9
9
|
expect(container.firstChild).toMatchSnapshot();
|
|
10
10
|
});
|
|
11
|
+
|
|
12
|
+
test('renders without uplinks', () => {
|
|
13
|
+
window.__VERDACCIO_BASENAME_UI_OPTIONS.showUplinks = false;
|
|
14
|
+
render(<DetailContainer />);
|
|
15
|
+
expect(screen.queryByTestId('uplinks-tab')).toBeFalsy();
|
|
16
|
+
});
|
|
17
|
+
|
|
11
18
|
test.todo('should test click on tabs');
|
|
12
19
|
});
|
|
@@ -2,7 +2,7 @@ import Box from '@mui/material/Box';
|
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
3
|
|
|
4
4
|
import Deprecated from '../../components/Deprecated';
|
|
5
|
-
import { useVersion } from '../../providers';
|
|
5
|
+
import { useConfig, useVersion } from '../../providers';
|
|
6
6
|
import ContainerContent from './ContainerContent';
|
|
7
7
|
import Tabs from './Tabs';
|
|
8
8
|
|
|
@@ -14,7 +14,10 @@ export enum TabPosition {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
const DetailContainer: React.FC = () => {
|
|
17
|
-
const
|
|
17
|
+
const { configOptions } = useConfig();
|
|
18
|
+
const tabs = configOptions.showUplinks
|
|
19
|
+
? Object.values(TabPosition)
|
|
20
|
+
: Object.values(TabPosition).filter((tab) => tab !== TabPosition.UPLINKS);
|
|
18
21
|
const [tabPosition, setTabPosition] = useState(0);
|
|
19
22
|
const { readMe, packageMeta } = useVersion();
|
|
20
23
|
|
|
@@ -23,8 +26,12 @@ const DetailContainer: React.FC = () => {
|
|
|
23
26
|
};
|
|
24
27
|
|
|
25
28
|
return (
|
|
26
|
-
<Box component="div" display="flex" flexDirection="column" padding={
|
|
27
|
-
<Tabs
|
|
29
|
+
<Box component="div" display="flex" flexDirection="column" padding={0}>
|
|
30
|
+
<Tabs
|
|
31
|
+
onChange={handleChange}
|
|
32
|
+
showUplinks={configOptions.showUplinks}
|
|
33
|
+
tabPosition={tabPosition}
|
|
34
|
+
/>
|
|
28
35
|
{packageMeta?.latest?.deprecated && <Deprecated message={packageMeta?.latest?.deprecated} />}
|
|
29
36
|
<ContainerContent readDescription={readMe} tabPosition={tabs[tabPosition]} />
|
|
30
37
|
</Box>
|
|
@@ -9,16 +9,19 @@ import { Theme } from '../../Theme';
|
|
|
9
9
|
interface Props {
|
|
10
10
|
onChange: (event: React.ChangeEvent<{}>, newValue: number) => void;
|
|
11
11
|
tabPosition: number;
|
|
12
|
+
showUplinks?: boolean;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
const DetailContainerTabs: React.FC<Props> = ({ tabPosition, onChange }) => {
|
|
15
|
+
const DetailContainerTabs: React.FC<Props> = ({ tabPosition, onChange, showUplinks }) => {
|
|
15
16
|
const { t } = useTranslation();
|
|
16
17
|
return (
|
|
17
18
|
<Tabs onChange={onChange} value={tabPosition} variant={'fullWidth'}>
|
|
18
19
|
<Tab data-testid={'readme-tab'} id={'readme-tab'} label={t('tab.readme')} />
|
|
19
20
|
<Tab data-testid={'dependencies-tab'} id={'dependencies-tab'} label={t('tab.dependencies')} />
|
|
20
21
|
<Tab data-testid={'versions-tab'} id={'versions-tab'} label={t('tab.versions')} />
|
|
21
|
-
|
|
22
|
+
{showUplinks && (
|
|
23
|
+
<Tab data-testid={'uplinks-tab'} id={'uplinks-tab'} label={t('tab.uplinks')} />
|
|
24
|
+
)}
|
|
22
25
|
</Tabs>
|
|
23
26
|
);
|
|
24
27
|
};
|
|
@@ -50,15 +50,22 @@ const Footer = () => {
|
|
|
50
50
|
<Icon>
|
|
51
51
|
<FlagsIcon.TW />
|
|
52
52
|
</Icon>
|
|
53
|
+
<Icon>
|
|
54
|
+
<FlagsIcon.CA />
|
|
55
|
+
</Icon>
|
|
53
56
|
</Flags>
|
|
54
57
|
</ToolTip>
|
|
55
58
|
</Left>
|
|
56
59
|
<Right>
|
|
57
60
|
{configOptions?.version && (
|
|
58
61
|
<>
|
|
59
|
-
<
|
|
60
|
-
<Logo
|
|
61
|
-
|
|
62
|
+
<PoweredBy data-testid="version-footer">{t('footer.powered-by')}</PoweredBy>
|
|
63
|
+
<Logo
|
|
64
|
+
isDefault={true}
|
|
65
|
+
onClick={goToVerdaccioWebsite}
|
|
66
|
+
size="x-small"
|
|
67
|
+
title={configOptions.version}
|
|
68
|
+
/>
|
|
62
69
|
</>
|
|
63
70
|
)}
|
|
64
71
|
</Right>
|
|
@@ -69,13 +76,17 @@ const Footer = () => {
|
|
|
69
76
|
|
|
70
77
|
export default Footer;
|
|
71
78
|
|
|
79
|
+
const PoweredBy = styled('span')(() => ({
|
|
80
|
+
paddingRight: '5px',
|
|
81
|
+
}));
|
|
82
|
+
|
|
72
83
|
const StyledEarth = styled(Earth)<{ theme?: Theme }>(({ theme }) => ({
|
|
73
84
|
margin: theme.spacing(0, 1),
|
|
74
85
|
}));
|
|
75
86
|
|
|
76
87
|
const Flags = styled('span')<{ theme?: Theme }>(({ theme }) => ({
|
|
77
88
|
display: 'inline-grid',
|
|
78
|
-
gridTemplateColumns: 'repeat(
|
|
89
|
+
gridTemplateColumns: 'repeat(10, max-content)',
|
|
79
90
|
gridGap: theme.spacing(0, 1),
|
|
80
91
|
position: 'absolute',
|
|
81
92
|
background: theme?.palette.greyAthens,
|
|
@@ -14,6 +14,8 @@ export const Inner = styled('div')<{ theme?: Theme }>(({ theme }) => ({
|
|
|
14
14
|
display: 'flex',
|
|
15
15
|
alignItems: 'center',
|
|
16
16
|
justifyContent: 'flex-end',
|
|
17
|
+
paddingLeft: 16,
|
|
18
|
+
paddingRight: 16,
|
|
17
19
|
width: '100%',
|
|
18
20
|
[`@media (min-width: ${theme?.breakPoints.medium}px)`]: {
|
|
19
21
|
minWidth: 400,
|
|
@@ -32,10 +34,12 @@ export const Left = styled('div')<{ theme?: Theme }>(({ theme }) => ({
|
|
|
32
34
|
[`@media (min-width: ${theme?.breakPoints.medium}px)`]: {
|
|
33
35
|
display: 'flex',
|
|
34
36
|
},
|
|
37
|
+
marginLeft: 1,
|
|
35
38
|
}));
|
|
36
39
|
|
|
37
40
|
export const Right = styled(Left)({
|
|
38
41
|
display: 'flex',
|
|
42
|
+
marginRight: 1,
|
|
39
43
|
});
|
|
40
44
|
|
|
41
45
|
export const Love = styled('span')<{ theme?: Theme }>(({ theme }) => ({
|
|
@@ -39,7 +39,7 @@ describe('<Header /> component with logged in state', () => {
|
|
|
39
39
|
cleanup();
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
test('should load the component
|
|
42
|
+
test('should load the component in logged out state', () => {
|
|
43
43
|
renderWithStore(
|
|
44
44
|
<Router>
|
|
45
45
|
<Header />
|
|
@@ -59,7 +59,9 @@ describe('<Header /> component with logged in state', () => {
|
|
|
59
59
|
</Router>,
|
|
60
60
|
store
|
|
61
61
|
);
|
|
62
|
-
|
|
62
|
+
act(() => {
|
|
63
|
+
store.dispatch.login.logInUser({ username: 'store', token: '12345' });
|
|
64
|
+
});
|
|
63
65
|
|
|
64
66
|
await waitFor(() => {
|
|
65
67
|
expect(screen.getByTestId('logInDialogIcon')).toBeTruthy();
|
|
@@ -78,13 +80,13 @@ describe('<Header /> component with logged in state', () => {
|
|
|
78
80
|
const loginBtn = screen.getByTestId('header--button-login');
|
|
79
81
|
fireEvent.click(loginBtn);
|
|
80
82
|
|
|
81
|
-
const loginDialog = await waitFor(() => screen.
|
|
83
|
+
const loginDialog = await waitFor(() => screen.findByTestId('login--dialog'));
|
|
82
84
|
|
|
83
85
|
expect(loginDialog).toBeTruthy();
|
|
84
86
|
});
|
|
85
87
|
|
|
86
88
|
test('should login and logout the user', async () => {
|
|
87
|
-
const { getByText, getByTestId } = renderWithStore(
|
|
89
|
+
const { getByText, getByTestId, findByText, findByTestId } = renderWithStore(
|
|
88
90
|
<Router>
|
|
89
91
|
<Header />
|
|
90
92
|
</Router>,
|
|
@@ -104,14 +106,14 @@ describe('<Header /> component with logged in state', () => {
|
|
|
104
106
|
await act(async () => {
|
|
105
107
|
fireEvent.click(signInButton);
|
|
106
108
|
});
|
|
107
|
-
await waitFor(() =>
|
|
109
|
+
await waitFor(() => findByTestId('logInDialogIcon'));
|
|
108
110
|
const headerMenuAccountCircle = getByTestId('logInDialogIcon');
|
|
109
111
|
fireEvent.click(headerMenuAccountCircle);
|
|
110
112
|
|
|
111
113
|
// // wait for button Logout's appearance and return the element
|
|
112
|
-
const logoutBtn = await waitFor(() =>
|
|
114
|
+
const logoutBtn = await waitFor(() => findByText('button.logout'));
|
|
113
115
|
fireEvent.click(logoutBtn);
|
|
114
|
-
await waitFor(() =>
|
|
116
|
+
await waitFor(() => findByText('button.login'));
|
|
115
117
|
expect(getByText('button.login')).toBeTruthy();
|
|
116
118
|
});
|
|
117
119
|
|
|
@@ -169,12 +171,12 @@ describe('<Header /> component with logged in state', () => {
|
|
|
169
171
|
expect(infoBtn).toBeInTheDocument();
|
|
170
172
|
fireEvent.click(infoBtn);
|
|
171
173
|
// wait for registrationInfo modal appearance and return the element
|
|
172
|
-
const registrationInfoModal = await waitFor(() => screen.
|
|
174
|
+
const registrationInfoModal = await waitFor(() => screen.findByTestId('registryInfo--dialog'));
|
|
173
175
|
expect(registrationInfoModal).toBeTruthy();
|
|
174
176
|
});
|
|
175
177
|
|
|
176
178
|
test('should close the registrationInfo modal when clicking on the button close', async () => {
|
|
177
|
-
const { getByTestId,
|
|
179
|
+
const { getByTestId, findByText, queryByTestId } = renderWithStore(
|
|
178
180
|
<Router>
|
|
179
181
|
<Header HeaderInfoDialog={CustomInfoDialog} />
|
|
180
182
|
</Router>,
|
|
@@ -185,7 +187,7 @@ describe('<Header /> component with logged in state', () => {
|
|
|
185
187
|
fireEvent.click(infoBtn);
|
|
186
188
|
|
|
187
189
|
// wait for Close's button of registrationInfo modal appearance and return the element
|
|
188
|
-
const closeBtn = await waitFor(() =>
|
|
190
|
+
const closeBtn = await waitFor(() => findByText('button.close'));
|
|
189
191
|
fireEvent.click(closeBtn);
|
|
190
192
|
|
|
191
193
|
const hasRegistrationInfoModalBeenRemoved = await waitForElementToBeRemoved(() =>
|
|
@@ -1,29 +1,37 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Toolbar from '@mui/material/Toolbar';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { Link } from 'react-router-dom';
|
|
3
|
+
import { Link as RouterLink } from 'react-router-dom';
|
|
4
4
|
|
|
5
5
|
import { Logo, Search } from '../../';
|
|
6
|
-
import {
|
|
6
|
+
import { SearchWrapper } from './styles';
|
|
7
7
|
|
|
8
8
|
interface Props {
|
|
9
9
|
showSearch?: boolean;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
const StyledLink = styled(Link)({
|
|
13
|
-
marginRight: '1em',
|
|
14
|
-
});
|
|
15
|
-
|
|
16
12
|
const HeaderLeft: React.FC<Props> = ({ showSearch }) => (
|
|
17
|
-
<
|
|
18
|
-
|
|
13
|
+
<Toolbar
|
|
14
|
+
sx={{
|
|
15
|
+
display: 'flex',
|
|
16
|
+
padding: 0,
|
|
17
|
+
marginLeft: 1,
|
|
18
|
+
flex: 1,
|
|
19
|
+
'@media (min-width: 600px)': {
|
|
20
|
+
padding: 0,
|
|
21
|
+
marginLeft: 1,
|
|
22
|
+
marginRight: '20px',
|
|
23
|
+
},
|
|
24
|
+
}}
|
|
25
|
+
>
|
|
26
|
+
<RouterLink to={'/'}>
|
|
19
27
|
<Logo />
|
|
20
|
-
</
|
|
28
|
+
</RouterLink>
|
|
21
29
|
{showSearch && (
|
|
22
30
|
<SearchWrapper data-testid="search-container">
|
|
23
31
|
<Search />
|
|
24
32
|
</SearchWrapper>
|
|
25
33
|
)}
|
|
26
|
-
</
|
|
34
|
+
</Toolbar>
|
|
27
35
|
);
|
|
28
36
|
|
|
29
37
|
export default HeaderLeft;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import Button from '@mui/material/Button';
|
|
2
|
+
import Toolbar from '@mui/material/Toolbar';
|
|
2
3
|
import React, { MouseEvent, useEffect, useState } from 'react';
|
|
3
4
|
import { useTranslation } from 'react-i18next';
|
|
4
5
|
|
|
5
6
|
import { useCustomTheme } from '../../';
|
|
6
7
|
import HeaderMenu from './HeaderMenu';
|
|
7
8
|
import HeaderToolTip from './HeaderToolTip';
|
|
8
|
-
import { RightSide } from './styles';
|
|
9
9
|
|
|
10
10
|
interface Props {
|
|
11
11
|
showSearch?: boolean;
|
|
@@ -75,7 +75,18 @@ const HeaderRight: React.FC<Props> = ({
|
|
|
75
75
|
};
|
|
76
76
|
|
|
77
77
|
return (
|
|
78
|
-
<
|
|
78
|
+
<Toolbar
|
|
79
|
+
data-testid="header-right"
|
|
80
|
+
sx={{
|
|
81
|
+
display: 'flex',
|
|
82
|
+
padding: 0,
|
|
83
|
+
marginRight: 0,
|
|
84
|
+
'@media (min-width: 600px)': {
|
|
85
|
+
padding: 0,
|
|
86
|
+
marginRight: 0,
|
|
87
|
+
},
|
|
88
|
+
}}
|
|
89
|
+
>
|
|
79
90
|
{showSearch === true && (
|
|
80
91
|
<HeaderToolTip
|
|
81
92
|
onClick={onToggleMobileNav}
|
|
@@ -124,7 +135,7 @@ const HeaderRight: React.FC<Props> = ({
|
|
|
124
135
|
)}
|
|
125
136
|
</>
|
|
126
137
|
)}
|
|
127
|
-
</
|
|
138
|
+
</Toolbar>
|
|
128
139
|
);
|
|
129
140
|
};
|
|
130
141
|
|
|
@@ -9,9 +9,9 @@ import ReactMarkdown from 'react-markdown';
|
|
|
9
9
|
import { useSelector } from 'react-redux';
|
|
10
10
|
|
|
11
11
|
import { RootState, Theme } from '../../';
|
|
12
|
+
import RegistryInfoDialog from '../../components/RegistryInfoDialog';
|
|
12
13
|
import LanguageSwitch from './LanguageSwitch';
|
|
13
14
|
import RegistryInfoContent from './RegistryInfoContent';
|
|
14
|
-
import RegistryInfoDialog from './RegistryInfoDialog';
|
|
15
15
|
|
|
16
16
|
interface Props {
|
|
17
17
|
isOpen: boolean;
|
|
@@ -13,7 +13,7 @@ describe('<RegistryInfoContent /> component', () => {
|
|
|
13
13
|
expect(screen.getByText('packageManagers.description')).toBeInTheDocument();
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
test('should
|
|
16
|
+
test('should load the appropiate tab content when the tab is clicked', () => {
|
|
17
17
|
const props = { registryUrl: 'http://localhost:4872', scope: '@' };
|
|
18
18
|
render(<RegistryInfoContent registryUrl={props.registryUrl} scope={props.scope} />);
|
|
19
19
|
|
|
@@ -4,27 +4,18 @@ import AppBar from '@mui/material/AppBar';
|
|
|
4
4
|
import IconButton from '@mui/material/IconButton';
|
|
5
5
|
import Toolbar from '@mui/material/Toolbar';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Theme } from '../../Theme';
|
|
8
8
|
|
|
9
9
|
export const InnerNavBar = styled(Toolbar)({
|
|
10
10
|
justifyContent: 'space-between',
|
|
11
11
|
alignItems: 'center',
|
|
12
|
-
padding:
|
|
12
|
+
padding: 0,
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
export const Greetings = styled('span')({
|
|
16
16
|
margin: '0 5px 0 0',
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
-
export const RightSide = styled(Toolbar)({
|
|
20
|
-
display: 'flex',
|
|
21
|
-
padding: 0,
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
export const LeftSide = styled(RightSide)({
|
|
25
|
-
flex: 1,
|
|
26
|
-
});
|
|
27
|
-
|
|
28
19
|
export const MobileNavBar = styled('div')<{ theme?: Theme }>((props) => ({
|
|
29
20
|
alignItems: 'center',
|
|
30
21
|
display: 'flex',
|
|
@@ -50,6 +41,7 @@ export const SettingsButtom = styled(IconButton)({});
|
|
|
50
41
|
export const SearchWrapper = styled('div')({
|
|
51
42
|
display: 'none',
|
|
52
43
|
width: '100%',
|
|
44
|
+
marginLeft: 20,
|
|
53
45
|
});
|
|
54
46
|
|
|
55
47
|
export const NavBar = styled(AppBar)<{ theme?: Theme }>(({ theme }) => ({
|
|
@@ -83,7 +75,7 @@ export const NavBar = styled(AppBar)<{ theme?: Theme }>(({ theme }) => ({
|
|
|
83
75
|
`,
|
|
84
76
|
[`@media (min-width: ${theme?.breakPoints.large}px)`]: css`
|
|
85
77
|
${InnerNavBar} {
|
|
86
|
-
padding: 0
|
|
78
|
+
padding: 0 16px;
|
|
87
79
|
}
|
|
88
80
|
`,
|
|
89
81
|
[`@media (min-width: ${theme?.breakPoints.xlarge}px)`]: css`
|
|
@@ -94,7 +86,3 @@ export const NavBar = styled(AppBar)<{ theme?: Theme }>(({ theme }) => ({
|
|
|
94
86
|
}
|
|
95
87
|
`,
|
|
96
88
|
}));
|
|
97
|
-
|
|
98
|
-
export const StyledLink = styled(Link)<{ theme?: Theme }>(({ theme }) => ({
|
|
99
|
-
color: theme?.palette.white,
|
|
100
|
-
}));
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { MemoryRouter } from 'react-router';
|
|
3
3
|
|
|
4
4
|
import { store } from '../../store';
|
|
5
|
-
import { renderWithStore, screen, waitFor } from '../../test/test-react-testing-library';
|
|
5
|
+
import { act, renderWithStore, screen, waitFor } from '../../test/test-react-testing-library';
|
|
6
6
|
import Home from './Home';
|
|
7
7
|
|
|
8
8
|
// force the windows to expand to display items
|
|
@@ -10,20 +10,28 @@ import Home from './Home';
|
|
|
10
10
|
jest.spyOn(HTMLElement.prototype, 'offsetHeight', 'get').mockReturnValue(600);
|
|
11
11
|
jest.spyOn(HTMLElement.prototype, 'offsetWidth', 'get').mockReturnValue(600);
|
|
12
12
|
|
|
13
|
-
const
|
|
13
|
+
const ComponentHome: React.FC = () => (
|
|
14
14
|
<MemoryRouter>
|
|
15
15
|
<Home />
|
|
16
16
|
</MemoryRouter>
|
|
17
17
|
);
|
|
18
18
|
|
|
19
19
|
describe('Home', () => {
|
|
20
|
+
afterEach(() => {
|
|
21
|
+
jest.clearAllMocks();
|
|
22
|
+
});
|
|
23
|
+
|
|
20
24
|
test('should render titles', async () => {
|
|
21
|
-
|
|
25
|
+
act(() => {
|
|
26
|
+
renderWithStore(<ComponentHome />, store);
|
|
27
|
+
});
|
|
22
28
|
await waitFor(() => expect(screen.getAllByTestId('package-item-list')).toHaveLength(5));
|
|
23
29
|
});
|
|
24
30
|
|
|
25
31
|
test('should render loading', async () => {
|
|
26
|
-
|
|
32
|
+
act(() => {
|
|
33
|
+
renderWithStore(<ComponentHome />, store);
|
|
34
|
+
});
|
|
27
35
|
await waitFor(() => expect(screen.getByTestId('loading')).toBeInTheDocument());
|
|
28
36
|
});
|
|
29
37
|
});
|