-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat-publish-veda-ui-to-npm
- Loading branch information
Showing
52 changed files
with
1,166 additions
and
715 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
app/scripts/components/common/page-footer/default-config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { getFooterSettingsFromVedaConfig } from 'veda'; | ||
const defaultFooterSettings = { | ||
secondarySection: { | ||
division: 'NASA EarthData 2024', | ||
version: 'BETA VERSION', | ||
title: 'NASA Official', | ||
name: 'Manil Maskey', | ||
to: '[email protected]', | ||
type: 'email' | ||
}, | ||
returnToTop: true | ||
}; | ||
const footerSettings = | ||
getFooterSettingsFromVedaConfig() ?? defaultFooterSettings; | ||
|
||
export { footerSettings }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
import React, { ComponentType } from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import { navItems } from '../../../../../mock/veda.config.js'; | ||
import NasaLogoColor from '../nasa-logo-color'; | ||
import { NavItem } from '../page-header/types.js'; | ||
|
||
import PageFooter from './index'; | ||
|
||
const mockMainNavItems: NavItem[] = navItems.mainNavItems; | ||
const mockSubNavItems: NavItem[] = navItems.subNavItems; | ||
// const mockFooterSettings = footerSettings; | ||
const hideFooter = false; | ||
const mockLinkProperties = { | ||
pathAttributeKeyName: 'to', | ||
LinkElement: 'a' as unknown as ComponentType | ||
}; | ||
jest.mock('./default-config', () => ({ | ||
footerSettings: { | ||
secondarySection: { | ||
division: 'NASA EarthData 2024', | ||
version: 'BETA VERSION', | ||
title: 'NASA Official', | ||
name: 'test', | ||
to: '[email protected]', | ||
type: 'email' | ||
}, | ||
returnToTop: true | ||
} | ||
})); | ||
|
||
describe('PageFooter', () => { | ||
afterEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
test('renders the PageFooter', () => { | ||
render( | ||
<PageFooter | ||
mainNavItems={mockMainNavItems} | ||
subNavItems={mockSubNavItems} | ||
hideFooter={hideFooter} | ||
logoSvg={<NasaLogoColor />} | ||
linkProperties={mockLinkProperties} | ||
/> | ||
); | ||
const footerElement = document.querySelector('footer'); | ||
|
||
expect(footerElement).toBeInTheDocument(); | ||
expect(footerElement).not.toHaveClass('display-none'); | ||
}); | ||
|
||
test('renders correct buttons and links', () => { | ||
render( | ||
<PageFooter | ||
mainNavItems={mockMainNavItems} | ||
subNavItems={mockSubNavItems} | ||
hideFooter={hideFooter} | ||
logoSvg={<NasaLogoColor />} | ||
linkProperties={mockLinkProperties} | ||
/> | ||
); | ||
expect(screen.getByText('Data Catalog')).toBeInTheDocument(); | ||
expect(screen.getByText('Exploration')).toBeInTheDocument(); | ||
expect(screen.getByText('Stories')).toBeInTheDocument(); | ||
|
||
expect(screen.getByText('About')).toBeInTheDocument(); | ||
expect(screen.getByText('Return to top')).toBeInTheDocument(); | ||
}); | ||
}); | ||
|
||
describe('PageFooter dynamic settings', () => { | ||
test('Hide footer should function correctly', () => { | ||
jest.mock('./default-config', () => ({ | ||
footerSettings: { | ||
secondarySection: { | ||
division: 'NASA EarthData 2024', | ||
version: 'BETA VERSION', | ||
title: 'NASA Official', | ||
name: 'test', | ||
to: '[email protected]', | ||
type: 'email' | ||
}, | ||
returnToTop: true | ||
} | ||
})); | ||
render( | ||
<PageFooter | ||
linkProperties={mockLinkProperties} | ||
mainNavItems={mockMainNavItems} | ||
subNavItems={mockSubNavItems} | ||
hideFooter={true} | ||
logoSvg={<NasaLogoColor />} | ||
/> | ||
); | ||
const footerElement = document.querySelector('footer'); | ||
expect(footerElement).toHaveClass('display-none'); | ||
}); | ||
}); |
Oops, something went wrong.