fix: delay youtube overlay bootstrap until yomitan loads

This commit is contained in:
2026-03-25 20:36:50 -07:00
parent 55300e2d8c
commit 9dca83acd9
16 changed files with 143 additions and 24 deletions

View File

@@ -7,7 +7,7 @@ test('texthooker precheck no-ops when mode is disabled', () => {
const handlePrecheck = createHandleTexthookerOnlyModeTransitionHandler({
isTexthookerOnlyMode: () => false,
setTexthookerOnlyMode: () => {},
commandNeedsOverlayRuntime: () => true,
commandNeedsOverlayStartupPrereqs: () => true,
ensureOverlayStartupPrereqs: () => {},
startBackgroundWarmups: () => {
warmups += 1;
@@ -29,7 +29,7 @@ test('texthooker precheck disables mode and warms up on start command', () => {
setTexthookerOnlyMode: (enabled) => {
mode = enabled;
},
commandNeedsOverlayRuntime: () => false,
commandNeedsOverlayStartupPrereqs: () => false,
ensureOverlayStartupPrereqs: () => {
prereqs += 1;
},
@@ -55,7 +55,7 @@ test('texthooker precheck no-ops for texthooker command', () => {
setTexthookerOnlyMode: (enabled) => {
mode = enabled;
},
commandNeedsOverlayRuntime: () => true,
commandNeedsOverlayStartupPrereqs: () => true,
ensureOverlayStartupPrereqs: () => {},
startBackgroundWarmups: () => {},
logInfo: () => {},
@@ -64,3 +64,25 @@ test('texthooker precheck no-ops for texthooker command', () => {
handlePrecheck({ start: true, texthooker: true } as never);
assert.equal(mode, true);
});
test('texthooker precheck transitions for youtube playback startup prereqs', () => {
let mode = true;
let prereqs = 0;
const handlePrecheck = createHandleTexthookerOnlyModeTransitionHandler({
isTexthookerOnlyMode: () => mode,
setTexthookerOnlyMode: (enabled) => {
mode = enabled;
},
commandNeedsOverlayStartupPrereqs: () => true,
ensureOverlayStartupPrereqs: () => {
prereqs += 1;
},
startBackgroundWarmups: () => {},
logInfo: () => {},
});
handlePrecheck({ youtubePlay: 'https://youtube.com/watch?v=abc', texthooker: false } as never);
assert.equal(mode, false);
assert.equal(prereqs, 1);
});