mirror of
https://github.com/SomboChea/ui
synced 2026-01-18 09:06:14 +07:00
chore: migrate eslint@6.6.0 (#227)
* chore: migrate to eslint6 * chore: migrate to eslint6
This commit is contained in:
committed by
GitHub
parent
2a2784ba39
commit
e6b53c0479
@@ -17,7 +17,11 @@ describe('<Header /> component with logged in state', () => {
|
||||
test('should load the component in logged out state', () => {
|
||||
const { container, queryByTestId, getByText } = render(
|
||||
<Router>
|
||||
<Header onLogout={headerProps.handleLogout} onToggleLoginModal={headerProps.handleToggleLoginModal} scope={headerProps.scope} />
|
||||
<Header
|
||||
onLogout={headerProps.handleLogout}
|
||||
onToggleLoginModal={headerProps.handleToggleLoginModal}
|
||||
scope={headerProps.scope}
|
||||
/>
|
||||
</Router>
|
||||
);
|
||||
|
||||
@@ -46,7 +50,11 @@ describe('<Header /> component with logged in state', () => {
|
||||
test('should open login dialog', async () => {
|
||||
const { getByText } = render(
|
||||
<Router>
|
||||
<Header onLogout={headerProps.handleLogout} onToggleLoginModal={headerProps.handleToggleLoginModal} scope={headerProps.scope} />
|
||||
<Header
|
||||
onLogout={headerProps.handleLogout}
|
||||
onToggleLoginModal={headerProps.handleToggleLoginModal}
|
||||
scope={headerProps.scope}
|
||||
/>
|
||||
</Router>
|
||||
);
|
||||
|
||||
@@ -131,7 +139,9 @@ describe('<Header /> component with logged in state', () => {
|
||||
const closeBtn = await waitForElement(() => getByText('CLOSE'));
|
||||
fireEvent.click(closeBtn);
|
||||
|
||||
const hasRegistrationInfoModalBeenRemoved = await waitForElementToBeRemoved(() => queryByTestId('registryInfo--dialog'));
|
||||
const hasRegistrationInfoModalBeenRemoved = await waitForElementToBeRemoved(() =>
|
||||
queryByTestId('registryInfo--dialog')
|
||||
);
|
||||
expect(hasRegistrationInfoModalBeenRemoved).toBeTruthy();
|
||||
});
|
||||
test.todo('autocompletion should display suggestions according to the type value');
|
||||
|
||||
@@ -38,7 +38,12 @@ const Header: React.FC<Props> = ({ logo, withoutSearch, username, onLogout, onTo
|
||||
withoutSearch={withoutSearch}
|
||||
/>
|
||||
</InnerNavBar>
|
||||
<HeaderInfoDialog isOpen={isInfoDialogOpen} onCloseDialog={() => setOpenInfoDialog(false)} registryUrl={getRegistryURL()} scope={scope} />
|
||||
<HeaderInfoDialog
|
||||
isOpen={isInfoDialogOpen}
|
||||
onCloseDialog={() => setOpenInfoDialog(false)}
|
||||
registryUrl={getRegistryURL()}
|
||||
scope={scope}
|
||||
/>
|
||||
</NavBar>
|
||||
{showMobileNavBar && !withoutSearch && (
|
||||
<MobileNavBar>
|
||||
|
||||
@@ -17,9 +17,20 @@ interface Props {
|
||||
}
|
||||
|
||||
/* eslint-disable react/jsx-max-depth */
|
||||
const HeaderMenu: React.FC<Props> = ({ onLogout, username, isMenuOpen = false, anchorEl, onLoggedInMenu, onLoggedInMenuClose }) => (
|
||||
const HeaderMenu: React.FC<Props> = ({
|
||||
onLogout,
|
||||
username,
|
||||
isMenuOpen = false,
|
||||
anchorEl,
|
||||
onLoggedInMenu,
|
||||
onLoggedInMenuClose,
|
||||
}) => (
|
||||
<>
|
||||
<IconButton color="inherit" data-testid="header--menu-acountcircle" id="header--button-account" onClick={onLoggedInMenu}>
|
||||
<IconButton
|
||||
color="inherit"
|
||||
data-testid="header--menu-acountcircle"
|
||||
id="header--button-account"
|
||||
onClick={onLoggedInMenu}>
|
||||
<AccountCircle />
|
||||
</IconButton>
|
||||
<Menu
|
||||
|
||||
@@ -15,7 +15,14 @@ interface Props {
|
||||
onLogout: () => void;
|
||||
}
|
||||
|
||||
const HeaderRight: React.FC<Props> = ({ withoutSearch = false, username, onToggleLogin, onLogout, onToggleMobileNav, onOpenRegistryInfoDialog }) => {
|
||||
const HeaderRight: React.FC<Props> = ({
|
||||
withoutSearch = false,
|
||||
username,
|
||||
onToggleLogin,
|
||||
onLogout,
|
||||
onToggleMobileNav,
|
||||
onOpenRegistryInfoDialog,
|
||||
}) => {
|
||||
const [anchorEl, setAnchorEl] = useState();
|
||||
const [isMenuOpen, setIsMenuOpen] = useState();
|
||||
|
||||
@@ -47,7 +54,9 @@ const HeaderRight: React.FC<Props> = ({ withoutSearch = false, username, onToggl
|
||||
|
||||
return (
|
||||
<RightSide>
|
||||
{!withoutSearch && <HeaderToolTip onClick={onToggleMobileNav} title={'Search packages'} tooltipIconType={'search'} />}
|
||||
{!withoutSearch && (
|
||||
<HeaderToolTip onClick={onToggleMobileNav} title={'Search packages'} tooltipIconType={'search'} />
|
||||
)}
|
||||
<HeaderToolTip title={'Documentation'} tooltipIconType={'help'} />
|
||||
<HeaderToolTip onClick={onOpenRegistryInfoDialog} title={'Registry Information'} tooltipIconType={'info'} />
|
||||
{username ? (
|
||||
|
||||
@@ -18,7 +18,10 @@ const HeaderToolTipIcon: React.FC<Props> = ({ tooltipIconType, onClick }) => {
|
||||
switch (tooltipIconType) {
|
||||
case 'help':
|
||||
return (
|
||||
<StyledExternalLink blank={true} data-testid={'header--tooltip-documentation'} to={'https://verdaccio.org/docs/en/installation'}>
|
||||
<StyledExternalLink
|
||||
blank={true}
|
||||
data-testid={'header--tooltip-documentation'}
|
||||
to={'https://verdaccio.org/docs/en/installation'}>
|
||||
<IconButton color={'inherit'}>
|
||||
<Help />
|
||||
</IconButton>
|
||||
@@ -26,7 +29,11 @@ const HeaderToolTipIcon: React.FC<Props> = ({ tooltipIconType, onClick }) => {
|
||||
);
|
||||
case 'info':
|
||||
return (
|
||||
<IconButton color="inherit" data-testid={'header--tooltip-info'} id="header--button-registryInfo" onClick={onClick}>
|
||||
<IconButton
|
||||
color="inherit"
|
||||
data-testid={'header--tooltip-info'}
|
||||
id="header--button-registryInfo"
|
||||
onClick={onClick}>
|
||||
<Info />
|
||||
</IconButton>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user