diff --git a/entry_types/scrolled/package/spec/widgets/defaultNavigation/Defaultnavigation-spec.js b/entry_types/scrolled/package/spec/widgets/defaultNavigation/Defaultnavigation-spec.js index c782566ea..f2f8817a2 100644 --- a/entry_types/scrolled/package/spec/widgets/defaultNavigation/Defaultnavigation-spec.js +++ b/entry_types/scrolled/package/spec/widgets/defaultNavigation/Defaultnavigation-spec.js @@ -32,6 +32,53 @@ describe('DefaultNavigation', () => { }); }); + it('uses theme logo by default', () => { + const {getByRole} = renderInEntry( + , + { + seed: { + themeAssets: { + logoDesktop: 'logo-desktop.png' + }, + themeOptions: { + logoUrl: 'https://example.com', + logoAltText: 'My logo' + } + } + } + ); + + expect(getByRole('link', {name: 'My logo'})).toBeInTheDocument(); + expect(getByRole('link', {name: 'My logo'})).toHaveAttribute('href', 'https://example.com'); + expect(getByRole('img', {name: 'My logo'})).toHaveAttribute('src', 'logo-desktop.png'); + }); + + it('takes logo props', () => { + const {getByRole} = renderInEntry( + , + { + seed: { + themeAssets: { + logoDesktop: 'logo.png' + }, + themeOptions: { + logoUrl: 'https://exmaple.com', + logoAltText: 'My logo' + } + } + } + ); + + expect(getByRole('link', {name: 'Other logo'})).toBeInTheDocument(); + expect(getByRole('link', {name: 'Other logo'})).toHaveAttribute('href', 'https://other.example.com'); + expect(getByRole('img', {name: 'Other logo'})).toHaveAttribute('src', 'other-logo.png'); + }); + it('supports extra buttons component', () => { const ExtraButtons = () => ; const {queryByRole} = renderInEntry( diff --git a/entry_types/scrolled/package/src/widgets/defaultNavigation/DefaultNavigation.js b/entry_types/scrolled/package/src/widgets/defaultNavigation/DefaultNavigation.js index 63345f48b..e887aba9c 100644 --- a/entry_types/scrolled/package/src/widgets/defaultNavigation/DefaultNavigation.js +++ b/entry_types/scrolled/package/src/widgets/defaultNavigation/DefaultNavigation.js @@ -26,7 +26,11 @@ import {Scroller} from './Scroller'; import styles from './DefaultNavigation.module.css'; -export function DefaultNavigation({configuration, ExtraButtons, MobileMenu}) { +export function DefaultNavigation({ + configuration, + ExtraButtons, MobileMenu, + logo +}) { const [navExpanded, setNavExpanded] = useState(true); const [mobileNavHidden, setMobileNavHidden] = useState(true); const [readingProgress, setReadingProgress] = useState(0); @@ -132,7 +136,7 @@ export function DefaultNavigation({configuration, ExtraButtons, MobileMenu}) { mobileNavHidden={mobileNavHidden}/>} - + {renderNav()} {MobileMenu && - - - {theme.options.logoAltText} + + + {altText );