Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MWPW-159197 Invoke onReady of standalone gnav when it is rendered #2962

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -1045,7 +1045,7 @@ export default async function init(block) {
content,
block,
});
gnav.init();
await gnav.init();
block.setAttribute('daa-im', 'true');
const mepMartech = mep?.martech || '';
block.setAttribute('daa-lh', `gnav|${getExperienceName()}${mepMartech}`);
Expand Down
10 changes: 7 additions & 3 deletions test/blocks/global-navigation/test-utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,12 @@ export const createFullGlobalNavigation = async ({
),
]);

const instance = await initGnav(document.body.querySelector('header'));
instance.imsReady();
await clock.runAllAsync();
const instancePromise = initGnav(document.body.querySelector('header'));

await clock.runToLastAsync();
const instance = await instancePromise;
const imsPromise = instance.imsReady();
await clock.runToLastAsync();
// We restore the clock here, because waitForElement uses setTimeout
clock.restore();

Expand All @@ -241,6 +244,7 @@ export const createFullGlobalNavigation = async ({
waitForElements.push(waitForElement(selectors.breadcrumbsWrapper, document.body));
}
await Promise.all(waitForElements);
await imsPromise;

window.fetch = ogFetch;
window.adobeIMS = undefined;
Expand Down
Loading