Skip to content

Commit

Permalink
MWPW-160014 : Search container for Standalone Gnav on devices (#3049)
Browse files Browse the repository at this point in the history
search container on gnav for devices

Co-authored-by: Snehal Sonawane <[email protected]>
  • Loading branch information
sonawanesnehal3 and Snehal Sonawane authored Oct 21, 2024
1 parent d9962d7 commit 332c3a5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion libs/blocks/global-navigation/global-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ class Gnav {
${this.decorateBrand()}
</div>
${this.elements.navWrapper}
${getConfig().searchEnabled === 'on' ? toFragment`<div class="feds-client-search"></div>` : ''}
${this.useUniversalNav ? this.blocks.universalNav : ''}
${(!this.useUniversalNav && this.blocks.profile.rawElem) ? this.blocks.profile.decoratedElem : ''}
${this.decorateLogo()}
Expand Down Expand Up @@ -839,7 +840,6 @@ class Gnav {
${isDesktop.matches ? '' : this.decorateSearch()}
${this.elements.mainNav}
${isDesktop.matches ? this.decorateSearch() : ''}
${getConfig().searchEnabled === 'on' ? toFragment`<div class="feds-client-search"></div>` : ''}
</div>
`;

Expand Down
4 changes: 4 additions & 0 deletions libs/navigation/navigation.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@ header.global-navigation, header.global-navigation.feds--dark {
padding: 0 15px;
}
}

.feds-client-search {
margin-left: auto;
}
2 changes: 1 addition & 1 deletion test/blocks/global-navigation/global-navigation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ describe('global navigation', () => {
describe('Client search feature in global navigation', () => {
it('should append the feds-client-search div when search is enabled', async () => {
await createFullGlobalNavigation({ customConfig: { searchEnabled: 'on' } });
expect(document.querySelector(selectors.topNavWrapper).classList.contains('feds-client-search')).to.exist;
expect(document.querySelector(selectors.topNav).classList.contains('feds-client-search')).to.exist;
});
});

Expand Down
1 change: 1 addition & 0 deletions test/blocks/global-navigation/test-utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const selectors = {
promo: '.feds-promo',
promoImage: '.feds-promo-image',
topNavWrapper: '.feds-topnav-wrapper',
topNav: '.feds-topnav',
breadcrumbsWrapper: '.feds-breadcrumbs-wrapper',
mainNav: '.feds-nav',
imsSignIn: '.feds-signIn',
Expand Down

0 comments on commit 332c3a5

Please sign in to comment.