Commit cf2e3269 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Added (commented) main menue test.

parent f70bf6aa
Pipeline #89971 passed with stages
in 24 minutes and 34 seconds
{ {
"presets": ["@babel/react", "@babel/env"] "presets": ["@babel/react", "@babel/env", "next/babel", { "targets": { "node": "current" } }]
} }
\ No newline at end of file
...@@ -175,7 +175,7 @@ export default function MainMenu() { ...@@ -175,7 +175,7 @@ export default function MainMenu() {
</MenuBarMenu> </MenuBarMenu>
<MenuBarMenu name="about" route="/" icon={<AboutIcon/>}> <MenuBarMenu name="about" route="/" icon={<AboutIcon/>}>
<MenuBarItem <MenuBarItem
label="Information" name="about" route="/" label="Information" name="info" route="/"
tooltip="About the NOMAD Repository and Archive" tooltip="About the NOMAD Repository and Archive"
/> />
<MenuBarItem <MenuBarItem
......
/*
* Copyright The NOMAD Authors.
*
* This file is part of NOMAD. See https://nomad-lab.eu for further info.
*
* Licensed 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 React from 'react'
import 'regenerator-runtime/runtime'
// import { toBeInTheDocument } from '@testing-library/jest-dom'
// import { render, screen, within } from '@testing-library/react'
// import { MemoryRouter } from 'react-router-dom'
// import MainMenu from './MainMenu'
// import { allRoutes as routes } from './Routes'
// expect.extend({ toBeInTheDocument })
describe('<MainMenu />', () => {
it('renders menu items for all nav paths', () => {
// render(<MemoryRouter>
// <MainMenu />
// </MemoryRouter>)
// Object.keys(routes).forEach(key => {
// const route = routes[key]
// if (route.navPath) {
// let item = screen
// const path = route.navPath.split('/')
// for (let i = 0; i < path.length; i++) {
// const itemId = path[i]
// const element = item.getByTestId(itemId)
// expect(element).toBeInTheDocument()
// item = within(element)
// }
// }
// })
})
})
...@@ -109,6 +109,7 @@ export const MenuBarItem = React.forwardRef(({name, label, tooltip, route, href, ...@@ -109,6 +109,7 @@ export const MenuBarItem = React.forwardRef(({name, label, tooltip, route, href,
} }
const item = <MuiMenuItem const item = <MuiMenuItem
data-testid={name}
ref={ref} ref={ref}
dense dense
classes={{root: selected ? classes.selected : undefined}} classes={{root: selected ? classes.selected : undefined}}
...@@ -185,6 +186,7 @@ export function MenuBarMenu({name, label, children}) { ...@@ -185,6 +186,7 @@ export function MenuBarMenu({name, label, children}) {
</Button> </Button>
</ClickAwayListener> </ClickAwayListener>
<MuiMenu <MuiMenu
data-testid={name}
PopoverClasses={{root: classes.menuPopover, paper: classes.menuPaper}} PopoverClasses={{root: classes.menuPopover, paper: classes.menuPaper}}
elevation={1} elevation={1}
anchorEl={anchorEl} anchorEl={anchorEl}
......
...@@ -130,7 +130,7 @@ export const routes = { ...@@ -130,7 +130,7 @@ export const routes = {
exact: true, exact: true,
path: '/', path: '/',
appBarTitle: 'About, Documentation, Getting Help', appBarTitle: 'About, Documentation, Getting Help',
navPath: 'about/about', navPath: 'about/info',
component: About component: About
} }
} }
......
global.nomadEnv = {
'keycloakBase': 'https://nomad-lab.eu/fairdi/keycloak/auth/',
'keycloakRealm': 'fairdi_nomad_test',
'keycloakClientId': 'nomad_gui_dev',
'appBase': 'http://nomad-lab.eu/prod/rae/beta',
'debug': false,
'matomoEnabled': false,
'matomoUrl': 'https://nomad-lab.eu/fairdi/stat',
'matomoSiteId': '2',
'version': {
'label': '0.9.8',
'isBeta': false,
'isTest': true,
'usesBetaData': true,
'officialUrl': 'https://nomad-lab.eu/prod/rae/gui'
},
'encyclopediaEnabled': true,
'aitoolkitEnabled': true,
'oasis': false
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment