Skip to content

Commit

Permalink
Merge pull request #107 from happo/should-wait-for-completed
Browse files Browse the repository at this point in the history
Listen to `completed` storyRenderPhaseChanged event by default
  • Loading branch information
trotzig authored Jan 11, 2024
2 parents e6404fd + 57bfbdd commit 7843e30
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ let currentIndex = 0;
let defaultDelay;
let themeSwitcher;
let forcedHappoScreenshotSteps;
let shouldWaitForCompletedEvent = true;

async function waitForSomeContent(elem, start = time.originalDateNow()) {
const html = elem.innerHTML.trim();
Expand Down Expand Up @@ -165,9 +166,6 @@ function renderStory(story, { force = false } = {}) {
}
}

const shouldWaitForCompletedEvent = (channel.events || {})
.storyRenderPhaseChanged;

if (shouldWaitForCompletedEvent) {
channel.on('storyRenderPhaseChanged', handleRenderPhaseChanged);
}
Expand Down Expand Up @@ -301,13 +299,16 @@ export function forceHappoScreenshot(stepLabel) {
throw e;
}

export const setDefaultDelay = (delay) => {
export function setDefaultDelay(delay) {
defaultDelay = delay;
};
export const setRenderTimeoutMs = (timeoutMs) => {
}
export function setRenderTimeoutMs(timeoutMs) {
renderTimeoutMs = timeoutMs;
};
export const setThemeSwitcher = (func) => {
}
export function setThemeSwitcher(func) {
themeSwitcher = func;
};
}
export function setShouldWaitForCompletedEvent(swfce) {
shouldWaitForCompletedEvent = swfce;
}
export const isHappoRun = () => window.__IS_HAPPO_RUN;

0 comments on commit 7843e30

Please sign in to comment.