fix: video caption issue (#36768)

This commit is contained in:
Jansen Kantor
2025-05-21 17:11:27 -04:00
committed by GitHub
parent 6740e75c0f
commit 5b440b4b13
2 changed files with 8 additions and 8 deletions

View File

@@ -637,7 +637,7 @@
spyOn(Caption, 'renderCaption');
spyOn(Caption, 'bindHandlers');
spyOn(Caption, 'updatePlayTime');
spyOn(Caption, 'renderGoogleDisclaimer');
spyOn(Caption, 'updateGoogleDisclaimer');
spyOn(Caption, 'hideCaptions');
spyOn(state, 'youtubeId').and.returnValue('Z5KLxerq05Y');
});
@@ -716,7 +716,7 @@
expect($.ajaxWithPrefix).toHaveBeenCalled();
expect(Caption.bindHandlers).toHaveBeenCalled();
expect(Caption.renderCaption).toHaveBeenCalled();
expect(Caption.renderGoogleDisclaimer).toHaveBeenCalled()
expect(Caption.updateGoogleDisclaimer).toHaveBeenCalled()
expect(Caption.updatePlayTime).not.toHaveBeenCalled();
expect(Caption.loaded).toBeTruthy();
});
@@ -1355,22 +1355,22 @@
})
it('not shown when captions are not ai generated', () => {
Caption.renderGoogleDisclaimer(BASE_CAPTIONS)
Caption.updateGoogleDisclaimer(BASE_CAPTIONS)
expect(state.shouldShowGoogleDisclaimer).toBe(false);
});
it('not shown when captions are not generated by gcp', () => {
Caption.renderGoogleDisclaimer(makeCaptions('someoneElse'))
Caption.updateGoogleDisclaimer(makeCaptions('someoneElse'))
expect(state.shouldShowGoogleDisclaimer).toBe(false);
});
it('shown when captions are generated by gcp', () => {
Caption.renderGoogleDisclaimer(makeCaptions('gcp'))
Caption.updateGoogleDisclaimer(makeCaptions('gcp'))
expect(state.shouldShowGoogleDisclaimer).toBe(true);
});
it('shown when captions have no provider', () => {
Caption.renderGoogleDisclaimer(makeCaptions())
Caption.updateGoogleDisclaimer(makeCaptions())
expect(state.shouldShowGoogleDisclaimer).toBe(true);
});
});

View File

@@ -507,7 +507,7 @@
var self = this,
state = this.state,
aiGeneratedSpan = captions.find(caption => caption.includes(aIGeneratedSpanText)),
captionsAIGenerated = !(aiGeneratedSpan === undefined);
captionsAIGenerated = !(aiGeneratedSpan === undefined),
aiCaptionProviderIsGoogle = true;
if (captionsAIGenerated) {
@@ -614,7 +614,7 @@
captions = self.updateProblematicCaptionsContent(captions, contentToReplace, replacementContent);
self.renderGoogleDisclaimer(captions);
self.updateGoogleDisclaimer(captions);
if (self.loaded) {
if (self.rendered) {