Skip to content

Commit

Permalink
Create a container element for search in standalone gnav (#2833)
Browse files Browse the repository at this point in the history
* Adding container for for search in standalone gnav

* Updating class name

* Adding unit test

* Removing space to fix eslint issue

* Updating unit test

* Updating unit test

* Accommodating review comments

* Fixing Eslint

* Accommodating review comments

* Updating client search

* Updating client search

---------

Co-authored-by: Snehal Sonawane <sonawane@Snehals-MacBook-Pro.local>
Co-authored-by: Snehal Sonawane <sonawane@snehals-mbp.corp.adobe.com>
  • Loading branch information
3 people authored Sep 16, 2024
1 parent 6fa9558 commit 13b62d5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions libs/blocks/global-navigation/global-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,7 @@ 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
2 changes: 1 addition & 1 deletion libs/navigation/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const blockConfig = [
name: 'global-navigation',
targetEl: 'header',
appendType: 'prepend',
params: ['imsClientId'],
params: ['imsClientId', 'searchEnabled'],
},
{
key: 'footer',
Expand Down
7 changes: 7 additions & 0 deletions test/blocks/global-navigation/global-navigation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -620,4 +620,11 @@ describe('global navigation', () => {
expect(document.querySelector(`${selectors.brandImage} img`).getAttribute('src')).to.equal('http://localhost:2000/test/blocks/global-navigation/mocks/adobe-dark-logo.svg');
});
});

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;
});
});
});

0 comments on commit 13b62d5

Please sign in to comment.